cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

[iOS SDK]Replace Sync API by .....

New member | Level 2
New member | Level 2

Hi you,

 

I have a issue about dropbox api v2. Before I use db api v1, I used 2 api key (one for upload/download <DBSession>, one for sync data<DBAccountManager>) and run parallel. But when migrate to api v2, I only have a interface <DropboxClientManger>, so I just used a feature (upload/dowload or sync) in the same time. Anyone have any solutions for this issue?

 

Thanks,

Vang Doan

9 Replies 9
Highlighted

Re: [iOS SDK]Replace Sync API by .....

Dropboxer
Dropboxer
Hi Vang, I'm not sure I follow. Can you elaborate, and maybe share some code for what you had previously, and the new code that's giving you trouble? Thanks in advance!
Highlighted

Re: [iOS SDK]Replace Sync API by .....

Explorer | Level 3

Hi Greg K,

Sure. You can take a look my sample code below:

// Use for sync data
DBAccountManager *dbAccountManager = [[DBAccountManager alloc] initWithAppKey:dropboxSyncKey
secret:dropboxSyncSecret];
[DBAccountManager setSharedManager:dbAccountManager];
[G8RDropboxSyncManager sharedSyncManager];


// User for upload/download data
DBSession* dbSession = [[DBSession alloc] initWithAppKey:dropboxKey
appSecret:dropboxSecret
root:kDBRootDropbox];
[DBSession setSharedSession:dbSession];


You can imagine I have 2 buttons, one for login dropbox for upload data and one for sync data.

If you haven't clear yet. You can give a new question.

Thanks,
Vang Doan

Highlighted

Re: [iOS SDK]Replace Sync API by .....

Dropboxer
Dropboxer
Thanks! It looks like you were using both the Core SDK and the Sync SDK. They both use API v1, so you'll want to replace both of them with a single API v2 SDK.

The new API v2 SDKs are built more like the Core SDKs, giving you direct access to the API calls for uploading and downloading files, among other operations. You'll need to implement whatever sync functionality you need on top of that.

You can find all of the information on using the Dropbox API v2 Objective-C SDK here:

https://github.com/dropbox/dropbox-sdk-obj-c
Highlighted

Re: [iOS SDK]Replace Sync API by .....

Explorer | Level 3

Hi Greg K,

 

You mean on Dropbox V2 don't support api same addObserver (will notify when have any change on dropbox). :(

 

Thank,

Vang Doan

Highlighted

Re: [iOS SDK]Replace Sync API by .....

Dropboxer
Dropboxer

That's correct, the API v2 SDKs don't offer the exact same interface/functionality as the Sync SDKs did.

 

You can replicate that functionality though, using listFolderLongpoll. That enables low-latency notification of changes in the account.

Highlighted

Re: [iOS SDK]Replace Sync API by .....

Explorer | Level 3

Hi Greg K,

 

Thank you so much for this supporting

 

Thanks,

Vang Doan

Highlighted

Re: [iOS SDK]Replace Sync API by .....

Explorer | Level 3

Hi Greg K,

I have issue, please help me

Please image below :

https://www.dropbox.com/s/7wgyh64a1oa68sx/Screen%20Shot%202016-10-27%20at%204.15.37%20PM.png?dl=0

As you saw, one folder I create normally and one folder is created by SyncAPI.

 

Problem: when I use dropbox api v2 

[fileRoutes listFolder:kDropboxSyncFolder recursive:@(YES) includeMediaInfo:@(NO) includeDeleted:@(NO) includeHasExplicitSharedMembers:@(NO)]

 

Result:  - with normal folder (above) response return only one folder

              - with sync folder (below) reponse return all folder (include subfolders).

 

You have anyway can create a sync folder? because I need uniform for new app and older app.

Please help me

 

Thanks,

Vang

Highlighted

Re: [iOS SDK]Replace Sync API by .....

Dropboxer
Dropboxer

The first folder in your screenshot, without the puzzle piece icon, is a normal folder, (e.g., explicitly created by an app with the "full Dropbox" permission).

 

The second folder in your screenshot, with the puzzle piece icon, is a special "app folder", which automatically gets created when you connect an API app with the "app folder" permission to an account.

 

If you want to use the existing app folder, you can use the existing app key for your app with the "app folder" permission, in this case your "CaptureAudioSync" app. API v2 does support the app folder permission, so you can also use that in the API v2 SDKs as well.

Highlighted

Re: [iOS SDK]Replace Sync API by .....

Explorer | Level 3

Hi Greg K,

 

Yes, I undertood your idea. But as you knew,  if my app used one key (key upload/download) and users logged in, then if I change appkey when user use feature sync data --> logging  before will be closed session. :(

 

That mean, at same time my app can NOT use 2 features (upload & sync) :(

 

 

Thanks,

Vang Doan

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?