2015-06-03 42 views
6

tôi sử dụng phương pháp này để hiển thị một UIDocumentPicker:UIDocumentPickerViewController -> "Không Documents" vì iCloud không có sẵn

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) 
} 

Các UIDocumentPicker được hiển thị độc đáo, nhưng nó luôn luôn hiển thị

Không Document, Documents trong iCloud Drive không khả dụng vì Tài liệu iCloud & Cài đặt dữ liệu bị tắt

enter image description here

Nhưng khi tôi kiểm tra Trạng thái iCloud, iCloud Drive được bật! (App của tôi thậm chí còn xuất hiện trong các thiết lập ở đó, cũng được kích hoạt!)

enter image description here

Điều này xảy ra trong mô phỏng và trên thiết bị (thông qua một Prerelease phân phối bởi Apple TestFlight)

Trả lời

9

Lỗi này có thể được gây ra do các hằng số UTI không hợp lệ:

Đảm bảo kiểm tra kỹ số UTI bạn chuyển đến tham số documentTypes. Trong trường hợp này, hãy lưu ý khoảng trống trong public.composite-content chuỗi

Các vấn đề liên quan