I add a fuction with named checkAndPerformV1TokenMigration as following :
-(void)performDropboxMigrationFromV1ToV2
{
BOOL willPerformMigration = [DBClientsManager checkAndPerformV1TokenMigration:^(BOOL shouldRetry, BOOL invalidAppKeyOrSecret,
NSArray<NSArray<NSString *> *> *unsuccessfullyMigratedTokenData) {
if (invalidAppKeyOrSecret) {
// Developers should ensure that the appropriate app key and secret are being supplied.
// If your app has multiple app keys / secrets, then run this migration method for
// each app key / secret combination, and ignore this boolean.
}
if (shouldRetry) {
// Store this BOOL somewhere to retry when network connection has returned
}
if ([unsuccessfullyMigratedTokenData count] != 0) {
NSLog(@The following tokens were unsucessfully migrated:);
for (NSArray<NSString *> *tokenData in unsuccessfullyMigratedTokenData) {
NSLog(@DropboxUserID: %@, AccessToken: %@, AccessTokenSecret: %@, StoredAppKey: %@", tokenData[0],
tokenData[1], tokenData[2], tokenData[3]);
}
}
if (!invalidAppKeyOrSecret && !shouldRetry && [unsuccessfullyMigratedTokenData count] == 0) {
[DBClientsManager setupWithAppKey:DROPBOX_APP_KEY];
}
} queue:nil appKey:DROPBOX_APP_KEY appSecret:DROPBOX_APP_SECRET];
if (!willPerformMigration) {
[DBClientsManager setupWithAppKey:DROPBOX_APP_KEY];
}
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self performDropboxMigrationFromV1ToV2];
// Do I still need add following line code:
// [DBClientsManager setupWithAppKey:@"<APP_KEY>"]; ??
return YES;
}
I perform the function in didFinishLaunchWithOption function but after taht.
Do I still need add [DBClientsManager setupWithAppKey:@<APP_KEY>] indidFinishLaunchWithOption ??