Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIDocumentPickerViewController -> "No Documents" because iCloud not available

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)

like image 668
gutenmorgenuhu Avatar asked Jun 03 '15 11:06

gutenmorgenuhu


1 Answers

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

like image 57
gutenmorgenuhu Avatar answered Sep 18 '22 01:09

gutenmorgenuhu