cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Obj-C Trying to upload but am having some issues

Obj-C Trying to upload but am having some issues

FYVE
Explorer | Level 3

Hello,

 

I'm trying to upload files from my app but entering in my fileURLWithPath code doesn't seem to work. It keeps saying the file doesn't exist. I read the exact path in the console and pasted it in but it still can't find the file. 

That is trying the batchUpload.

 

I'm getting this error:

No visible @interface for 'DBFILESUserAuthRoutes' declares the selector 'uploadData:mode:autorename:clientModified:mute:propertyGroups:inputData:'

When I try using the first method in the documentation. Any help with this would be amazing... I can't sort it out.

 

Also, is there a way to upload/download all files of a certain type from a folder? Like if I wanted to upload/download all .sav files for example. Is this possible?

3 Replies 3

Greg-DB
Dropbox Staff

Regarding the first issue, with the file not being found, we'd need more information to be able to offer help. If you're still having trouble with that, please share the full steps and code to reproduce the issue. 

Regarding the second issue, with the uploadData method not being found, that selector looks correct. What version number of the SDK do you have installed though? It sounds like you may have an older version without that method definition. Make sure you're using the latest version, currently v3.9.1.

And regarding the last question, the Dropbox API doesn't offer an automatic way to do that, but you can certainly list the contents of the folder, filter the results to the desired entries (i.e., based on the extension), and then download each of those desired files.

FYVE
Explorer | Level 3

Thanks! 

I figured out the first issue. It was App Sandbox changing a random string of numbers in the local path every time the app launched. Whoops.

 

Second issue was solved with an update thank you.

 

Now stuck on upload/overwrite. Where it wants the file data here: 

NSData *fileData = [@"file data example" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];

 I'm giving it the local path to the file like the batch upload method but it just makes a file with text of the path I gave it. That can't be right! Ahah

Also, thanks! I'll have to look into how to do that for multiple downloads. 

Greg-DB
Dropbox Staff

Are you using uploadData for that? If you want to supply the URL to the local file instead of the Data directly, use one of the uploadUrl methods instead:

https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESUserAuthRoutes.html#/c:ob...:

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    FYVE Explorer | Level 3
What do Dropbox user levels mean?