In my application, I already integrated the Dropbox Sync SDK. So when the Dropbox Chooser SDK for iOS comes in, I give it a try.
My question is: when I tested my actual device, it says
"Failed to create the link. Sorry, an error occurred. Please try again later."
//Note. They say: "You may have a project that requires several keys of the application, since it also uses the Core or Sync API. In this case, you need to explicitly initialize your own Chooser instance with the right application key using the -initWithAppKey: method."
Update: Since I already have the same URL scheme for the Sync API, so I did to initialize another Chooser instance using the -initWithAppkey: method in both - application:openURL:sourceApplication:annotation: in my AppDelegate
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
... and my very best 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 } }]; }
source share