Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iosmike

macrumors member
Original poster
Apr 28, 2016
32
5
Toronto, Canada
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)

     

     

    }

 

 

 

 


}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.