UIDocumentPickerViewController -> "No Documents" because iCloud not available

1.9k Views Asked by At

I use this method to show an UIDocumentPicker:

func showDocumentPicker(){    
  let docPicker = UIDocumentPickerViewController(documentTypes: ["public.composite-content "], inMode: UIDocumentPickerMode.Import)
  docPicker.delegate = self
  docPicker.modalPresentationStyle = UIModalPresentationStyle.FullScreen
  self.presentViewController(docPicker, animated: true, completion: nil)
}

The UIDocumentPicker gets displayed nicely, but it always shows

No Document, Documents in iCloud Drive are not available because the iCloud Documents & Data setting is disabled

enter image description here

But when I check the iCloud Status, iCloud Drive is enabled! (My App even shows up in the settings there, also enabled!)

enter image description here

This happens in Simulator and on the device (via a Prerelease distributed by Apple TestFlight)

1

There are 1 best solutions below

0
On BEST ANSWER

This error can be caused due to invalid UTI-constants:

Make sure to double-check the UTIs you pass to the documentTypes parameter. In this case, note the blank space in the public.composite-content string