1

So I'm testing out Apple's new Document Provider extension. I'm trying to open up a UIDocumentMenuViewController up, and that part is working. But when I try to click on one of the items it presents, it just cancels the action sheet. This happens even when I click on the iCloud item, which is there by default. My code for presenting the controller is as follows:

let type_data = kUTTypeData.__conversion()
let documentMenuViewController = UIDocumentMenuViewController(documentTypes:   [type_data], inMode: UIDocumentPickerMode.Import)
navigationController.presentViewController(documentMenuViewController, animated: true, completion: nil)

Anyone know why this is happening?

1
  • Wasn't implementing the delegate methods...woops Commented Aug 24, 2014 at 0:22

2 Answers 2

3

You need to set the delegate on the UIDocumentMenuViewController. Then implement the -documentMenu:didPickDocumentPicker: delegate method. Then you can go ahead and present the documentPicker that was selected.

func documentMenu(documentMenu: UIDocumentMenuViewController!, didPickDocumentPicker documentPicker: UIDocumentPickerViewController!) {
    documentPicker.delegate = self
    self.presentViewController(documentPicker, animated: true, completion: nil)
}

There is a simple example of this here in Apple's guide.

Sign up to request clarification or add additional context in comments.

Comments

0

Take a look at the NewBox Apple sample code and you'll see the step you are missing. Can't provide the actual answer here as iOS 8 is still under NDA.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.