ios – UIDocumentPickerViewController – >“No Documents”,因为iCloud不可用

前端之家收集整理的这篇文章主要介绍了ios – UIDocumentPickerViewController – >“No Documents”,因为iCloud不可用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用此方法显示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)
}

UIDocumentPicker很好地显示,但它总是显示

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

但是当我检查iCloud状态时,iCloud Drive已启用! (我的应用程序甚至出现在那里的设置中,也启用了!)

这发生在模拟器和设备上(通过Apple TestFlight分发的预发布)

解决方法

由于UTI常量无效,可能导致此错误

确保仔细检查传递给documentTypes参数的UTI.在这种情况下,请注意public.composite-content字符串中的空格

猜你在找的iOS相关文章