I am testing the new UIDocumentPickerViewController API in iOS 8. I just want to open the file in iCloud to see how the interaction works.
This is the code that I run from my UIViewController :
- (IBAction)openDocument:(id)sender { [self showDocumentPickerInMode:UIDocumentPickerModeOpen]; } - (void)showDocumentPickerInMode:(UIDocumentPickerMode)mode { UIDocumentPickerViewController *picker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[(NSString *)kUTTypeData] inMode:mode]; picker.delegate = self; [self presentViewController:picker animated:YES completion:nil]; }
openDocument bound to a button in IB. When I click it, it opens the iCloud browser, but each folder in it is grayed out (I created some Keynote, Numbers and Pages files), so I canβt get to the files:
.
I checked some docs and did the following (no luck):
- Enabled iCloud in my application (in the Capabilities section for storing keys and iCloud Documents).
Added UTI for public.data in my Info.plist as follows:
<key>CFBundleDocumentTypes</key>
CFBundleTypeIconFile icon.png CFBundleTypeName My Details CFBundleTypeRole viewer LSItemContentTypes public.data LSTypeIsPackage NSDocumentClass Document NSPersistentStoreTypeKey binary
Added NSUbiquitousContainerIsDocumentScopePublic key with value YES in my Info.plist.
Any idea what might be wrong or missing?
source share