Failed to create communication error while using Dropbox Chooser SDK for iOS

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 { // 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 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 } }]; } 
+4
source share
1 answer

Make sure that you execute the request using the correct application key. Not the one you use for the synthesizer, but the new Drop-in app with its own app key.

If you did, try managing your own instance of DBChooser . Now you take an instance and call the init method on it. You must manage your own singleton instance, which you use through the application. You must create this instance using [[DBChooser alloc] initWithAppKey:@"my-dropbox-key"] . Never use the default function in your case.

+2
source

Source: https://habr.com/ru/post/1492678/


All Articles