In my app, I've already integrated Dropbox Sync SDK. So when the Dropbox Chooser SDK for iOS comes in, I give it a try.
My question is, when I tested on my actual device, it says
"Unable to Generate Link. Sorry, an error occurred. Please try again later."
// Note: They say "You may have a project that requires multiple app keys because it also uses the Core or Sync API. In this case, you'll need to explicitly initialize your own instance of the Chooser with the right app key by using the -initWithAppKey: method."
Update: Because I already has the same URL scheme for the Sync API, so what I did was to initialize another instance of Chooser with -initWithAppkey: method in both -application:openURL:sourceApplication:annotation: in my AppDelegate
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { // instantiate a new DBChooser instance with Chooser Key // .. make sure it should not include 'db-' prefix DBChooser *chooser = [[DBChooser alloc] initWithAppKey:@"my-chooser-key"]; if ([chooser handleOpenURL:url]) { // This was a Chooser response and handleOpenURL automatically ran the // completion block return YES; } return NO; } ... and my top most view controller.
- (void)didPressChoose { // .. make sure it should not include 'db-' prefix DBChooser *chooser = [[DBChooser alloc] initWithAppKey:@"my-dropbox-key"]; [chooser openChooserForLinkType:DBChooserLinkTypeDirect fromViewController:self completion:^(NSArray *results) { if ([results count]) { // Process results from Chooser _result = results[0]; NSLog(@"%@", _result.link); } else { // User canceled the action } }]; }