0

I'm migrating from the old Dropbox Obj-C SDK to the new one. I was using the following methods from the old SDK:

- deletePath: - uploadFile:toPath:withParentRev:fromPath: - loadMetadata: - cancelAllRequests

And a bunch of delegate calls:

- (void)restClient:(DBUserClient*)client uploadedFile:(NSString*)destPath from:(NSString*)srcPath metadata:(DBMetadata*)metadata - (void)restClient:(DBUserClient*)client uploadFileFailedWithError:(NSError*)error - (void)restClient:(DBUserClient*)client deletedPath:(NSString *)path - (void)restClient:(DBUserClient*)client deletePathFailedWithError:(NSError*)error - (void)restClient:(DBUserClient*)client loadedMetadata:(DBMetadata*)metadata - (void)restClient:(DBUserClient*)client metadataUnchangedAtPath:(NSString*)path - (void)restClient:(DBUserClient*)client loadMetadataFailedWithError:(NSError*)error - (void)sessionDidReceiveAuthorizationFailure:(DBSession*)session userId:(NSString *)userId

The new SDK doesn't seem to have anything like these methods - or delegates. I'm somewhat surprised that an SDK would be updated to be so completely different than what was already there. I am thinking that maybe I've got something wrong, that maybe there's another SDK I am missing? Surely it can't be that hard, despite any API changes, to maintain an SDK in a way that transitioning would be simple and intuitive, and not requiring major changes to the client code.

What am I doing wrong?

1 Answer 1

0

[Cross-linking for reference: https://www.dropboxforum.com/t5/API-Support-Feedback/DBRestClient-and-DBRestClientDelegate-replacement-in-v2/m-p/279439#M16767 ]

The Dropbox API v2 Objective-C SDK isn't built from the old Dropbox Core API v1 Objective-C SDK, so performing these actions works differently:

  • deletePath:

Use deleteV2.

  • uploadFile:toPath:withParentRev:fromPath:

Use one of the upload methods. There's an example here.

  • loadMetadata:

To get the metadata for a specific file, use getMetadata. To list the contents of a folder, use listFolder and listFolderContinue.

  • cancelAllRequests

The Dropbox API v2 Objective-C SDK doesn't offer a helper method like this for cancelling all requests at once. (We'll consider it a feature request though.) Instead, the methods return task objects you can track. You can then cancel any/all of the tasks as desired. For any particular task, that would look like:

DBUploadTask *req = [client.filesRoutes upload...
[req cancel];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.