We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
Quentin M.3
10 years agoNew member | Level 1
Never ending uploads with DropBox document picker export mode
Hi,
I wrote an app where people can backup the app data with iOS document menu/picker, it seems to work flawlessly with iCloud. I'm using iOS 9.2.1 and DropBox 4.2.
When I choose to export with DropBox, the upload never ends, although the file is really small (280KB) and my connection pretty fast. If my iPhone goes to sleep, the upload seems to have been aborted when I wake up the phone.
Is there something special to do to get UIDocumentPickerModeExportToService working with DropBox?
Thanks,
Quentin.
5 Replies
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
I don't think there should be anything special about using UIDocumentPickerModeExportToService with Dropbox in particular.
Can you share some sample code and steps to reproduce the issue so we can look into it? Thanks in advance!
- Quentin M.310 years agoNew member | Level 1
Thanks Gregory for your help!
The backup is a document bundle with a custom extension '.pwbackup', so may be there is something wrong with exporting a directory like that to Dropbox, and it would be better to create a zip archive.
To do the export, inside my app document directory I prepare a backup bundle, that contains a SQLite database, some attachments and a property list, then I present a UIDocumentMenuViewController:
let menu = UIDocumentMenuViewController(URL: backupURL, inMode: .ExportToService)
presentViewController(menu, animated: true, completion: nil)
When the user chooses the picker in the menu, I present it with:
func documentMenu(documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
documentPicker.delegate = self
presentViewController(documentPicker, animated: true) { }
}
When the document picker is done, I get rid of the backup I prepared locally. With Dropbox, this part is never called, since the transfer doesn't succeed:
func documentPicker(controller: UIDocumentPickerViewController, didPickDocumentAtURL url: NSURL) {
try NSFileManager().removeItemAtURL(backupURL)
}
In my app Info.plist, I have the following exported UTIs:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.composite-content</string>
<string>public.database</string>
<string>com.apple.package</string>
</array>
<key>UTTypeDescription</key>
<string>Placeboard Backup</string>
<key>UTTypeIdentifier</key>
<string>com.placeboardapp.backup</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>pwbackup</string>
</array>
</dict>
</dict>
</array>
Let me know if you need some additional info or code.
- Greg-DB10 years ago
Dropbox Community Moderator
Thanks for the additional information Quentin! I believe that is in fact the issue, in that the Dropbox document picker doesn't currently support folders/packages, so sending a zip file would be better. I'm sending this along as a feature request though.
- Quentin M.310 years agoNew member | Level 1
ok, I'll tweak the code to upload a zip file.
btw is there a page on Dropbox website that documents these APIs limitations?
Until uploading folders with the document picker is supported by Dropbox, it could also be nice to show a dialog explaining it's not possible.
Thanks for the quick reply!
- Greg-DB10 years ago
Dropbox Community Moderator
Thanks for the feedback! We don't currently have documentation for this, but I'll be sure to pass this along as a request for some.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 6 hours ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!