I want user to access iCould to pick documents. But in my simulator the iCould Drive is always empty. I already clicked Simulator - Debug - Trigger iCould sync after logged in when the app was running. So I want to know if something wrong with my code. Please help to check. Thank you for your time!
Code:
import UIKit
import MobileCoreServices
extensionViewController: UIDocumentMenuDelegate {
func documentMenu(documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
self.presentViewController(documentPicker, animated: true, completion: nil)
}
}
extensionViewController: UIDocumentPickerDelegate {
func documentPicker(controller: UIDocumentPickerViewController, didPickDocumentAtURL url: NSURL) {
print("pick document succeeded")
}
}
class ViewController: UIViewController {
var documents = [AnyObject]()
overridefunc viewDidLoad() {
super.viewDidLoad()
}
@IBActionfunc addDocuments(sender: AnyObject) {
let importMenu = UIDocumentMenuViewController(documentTypes: [kUTTypeTextasString, kUTTypePDFasString], inMode: .Import)
importMenu.delegate = self
self.presentViewController(importMenu, animated: true, completion: nil)
}
}