Issue with document and file provider extension

Hello, been trying to implement a document and file provider extension for the last couple of days.
I've been using [https://github.com/xamarin/monotouch-samples/tree/master/ios8/NewBox](this Xamarin example) as my guide, but I keep getting stuck at the same place.
In the end I just tried running the example, and lo and behold, it fails at the exact same place!

The problem arises when loading the UIDocumentPickerExtensionViewController from another app (like Google Drive), where the file provider should create a DocumentStorageUrl for saving files to that the host app can then access.
But, when running the test app for the first time, neither the directory nor the ProviderIdentifier (i.e. the File Provider) is created!

The next time the test app is run, yes, the ProviderIdentifier and directory is created, BUT the app still crashes. The log says I don't have access to the DocumentStorageUrl, which doesn't really make any sense.

After some googling I found that last year someone had a similar issue with Xamarin ([https://bugzilla.xamarin.com/show_bug.cgi?id=22787](look here)
And people have even posted about this issue on Apple's own forums [https://forums.developer.apple.com/thread/24065](look here)
However, I tried the test app on both iOS 8 and 9, and it doesn't work on either.

In conclusion: what the heck's going on?
How can you actually make the test app work?

The principle sounds really simple: create the extensions, set the app groups, make a proper interface, and run it. But no, apparently it's not enough.
What am I missing? Or is there something wrong with Xamarin or iOS?

Using:
Xamarin Studio 5.10
Xamarin.iOS 9.2.1.51
Mac OS X 10.11.1
Xcode 7.1.1

Answers

  • So, no-one's tried working with document picker/file provider extensions?

  • Finally found the issue, and it has to do with saving the file in any directory that's' not the DocumentStorageUrl.
    If you do that, and try to copy it to DocumentStorageUrl, it just won't work. Ever.
    Why? No idea, it's not like the documentation says anything about this...

    So in conclusion: download your file directly to DocumentStorageUrl, and you'll be fine. :)

    Except when you build your appstore version. Then, sure, the file will be downloaded to DocumentStorageUrl, but when you hand it over to the host app it'll be empty except for the string saying "these are the contents of the file".
    And yes, I checked the downloaded file, it's perfectly fine, has the right size, right format etc. But handing the file over to any app ruins it.
    Why? No idea, again, it's not like the documentation is of any help.

    I'll be back in a few weeks with more info, which will hopefully provide useful for any other developers making a document picker/file provider.

Sign In or Register to comment.