cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Getting an upload error - not sure why

Getting an upload error - not sure why

purringpigeon
Explorer | Level 4
Go to solution

I recently ran into the issue of the long lived tokens no longer working, so I needed to upgrade to the latest API and change the access. I am now running into an exception uploading content.

 

My old upload code was this (and nested other uploads if the first was successful), but this API was no longer present.

 

 

 

 

DBFILESWriteMode* mode = [[DBFILESWriteMode alloc]initWithOverwrite];
[[self.restClient.filesRoutes uploadData:@"/ServiceReport.sqlite"
                    mode:mode
                    autorename: NULL
                    clientModified:NULL
                    mute:NULL
                    inputData:sqllite]setResponseBlock:^(DBFILESFileMetadata * _Nullable result , DBFILESUploadError * _Nullable routeError, DBRequestError * _Nullable error) {
//repeat for each file to upload......
}];

 

 

 

 

So I replaced with what seemed like the correct replacement:

 

 

 

[[self.restClient.filesRoutes uploadData: @"/ServiceReport.sqlite"inputData:sqllite] setResponseBlock:^(DBFILESFileMetadata * _Nullable result , DBFILESUploadError * _Nullable routeError, DBRequestError * _Nullable error) {

//repeat for each file to upload
}];

 

 

 

 

But when I try this, I am getting the following error...

purringpigeon_0-1663814212274.png

I am not really sure what to try next... it seems my download to restore is working just fine, it's the upload that is failing.

 

Thank you for any pointers.

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

@purringpigeon wrote:
... But my old call was not compiling.

That's not something API related! Check what's wrong in your syntax, compiler options, etc.

View solution in original post

8 Replies 8

Здравко
Legendary | Level 20
Go to solution

Hi @purringpigeon,

Where you have set the mode to overwrite (as in first version)? 🤔 If missing, the behaviour is normal when file with the same name already exists. 😉

Hope this gives direction.

purringpigeon
Explorer | Level 4
Go to solution
How do I set the mode? I don’t see the option on the new API.

Здравко
Legendary | Level 20
Go to solution

@purringpigeon wrote:
How do I set the mode? I don’t see the option on the new API.

@purringpigeon wrote:

...

DBFILESWriteMode* mode = [[DBFILESWriteMode alloc]initWithOverwrite];
[[self.restClient.filesRoutes uploadData:@"/ServiceReport.sqlite"
                    mode:mode
                    ...

...


Something that's missing in you second code snippet! This part is nothing to do with the change of access token way of work. 😉

purringpigeon
Explorer | Level 4
Go to solution
When I had it with mode it complained the API was not correct. I’ll try again. I’m not sure why it failed. But my old call was not compiling.

Здравко
Legendary | Level 20
Go to solution

@purringpigeon wrote:
... But my old call was not compiling.

That's not something API related! Check what's wrong in your syntax, compiler options, etc.

Greg-DB
Dropbox Staff
Go to solution

@purringpigeon Здравко is correct, you should use the "mode" option to control this behavior. That's still available in the latest version of the SDK, as seen here. I recommend using Xcode's autocomplete feature to automatically template out the parameters.

purringpigeon
Explorer | Level 4
Go to solution

When I revert to the code I have above I get the following compile error:

 

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

purringpigeon
Explorer | Level 4
Go to solution

I found it - they added properties to it.

 

propertyGroups:NULL
strictConflict:NULL
contentHash:NULL

I am trying that.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    purringpigeon Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?