I'm able to bring up my dropbox account, but when I pick a file, nothing happens, like the completion handler isn't firing. Here is what I have. I initialize with my own key because I'm using the Sync API as well, so I have two keys.
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url
sourceApplication:(NSString *)source annotation:(id)annotation
{
DBChooser *chooser = [[DBChooser alloc] initWithAppKey:@"[my key]"];
if ([chooser handleOpenURL:url]) {
// This was a Chooser response and handleOpenURL automatically ran the
// completion block
return YES;
}
return NO;
}
and in my viewController.m
-(IBAction)didPressChooser:(id)sender {
DBChooser *newChooser = [[DBChooser alloc] initWithAppKey:@"[my key]"];
[newChooser openChooserForLinkType:DBChooserLinkTypeDirect
fromViewController:self completion:^(NSArray *results)
{
if ([results count]) {
DBChooserResult *_result = results[0];
NSString *extension = [_result.name pathExtension];
if ([extension isEqualToString:@"m4a"] || [extension isEqualToString:@"wav"] || [extension isEqualToString:@"mp4"] ||[extension isEqualToString:@"mp3"]) {
NSURL *dropboxURL;
dropboxURL = _result.link;
DBFileName = _result.name;
NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
session = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate:self delegateQueue: [NSOperationQueue mainQueue]];
NSURLSessionDownloadTask *getFile = [session downloadTaskWithURL:dropboxURL];
[getFile resume];
}
}
}];
}