Search code examples
ios8ios8-extension

documentStorageURL coming as null


I am trying to implement the document picker extension in my app. So In prepareForPresentationInMode method, I present my own navigation controller which shows the list of files. When user clicks on a file, I download the file and try to give the url path of the file to the app which invoked my extension as below,

    [(DocumentPickerViewController*)[self.navigationController delegate] dismissGrantingAccessToURL:[[(DocumentPickerViewController*) [self.navigationController delegate] documentStorageURL] URLByAppendingPathComponent:@"text.txt"]];

When I print the [(DocumentPickerViewController*) [self.navigationController delegate] documentStorageURL], it prints as null. Let me know if I am doing anything wrong.


Solution

  • This read-only property contains the value returned by your File Provider extension’s documentStorageURL method. If you do not provide a File Provider extension, it returns nil.

    As can be found here

    You'll have to provide your own URL that lies inside of your extension's folder (for example NSTemporaryDirectory())