Anand3777 Anand3777 - 1 year ago 128
iOS Question

My app is getting crashed on UIDocumentPickerViewController

I am working on file sharing on my iOS App, I am new to

UIDocumentPickerViewController
. I do not know why my app is crashing.

UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.image"] inMode:UIDocumentPickerModeImport];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];


App is crashing on the highlighted lines.

Has anyone done this previously? I want to do the same like the attachment below enter image description here

Answer Source

See Prerequisite section on Apple Documentation:

Before your app can use the document picker, you must turn on the iCloud Documents capabilities in Xcode

enter image description here

Let me know if this solve your problem!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download