<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dropbox chooser completion handler not firing in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85438#M2595</link>
    <description>&lt;P&gt;Nothing yet. I added @property DBChooser *chooser; to my viewController.h, and in my viewController.m I put:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_chooser = [[DBChooser alloc] initWithAppKey:@"ag56efd9sjxt8vv"];

        [_chooser 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];
                                                             }


                       }

         }];

}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in my AppDelegate.h I imported the ViewController.h and put in @property ViewController *viewController;&lt;/P&gt;

&lt;P&gt;and then in AppDelegate.m I have&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if ([self.viewController.chooser handleOpenURL:url]) {

        return YES;
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Same thing happens. It doesn't return to fire the completion handler.&lt;/P&gt;

&lt;P&gt;My permission is set for audio in the Dropbox app console. Not sure if that makes a difference&lt;/P&gt;</description>
    <pubDate>Mon, 09 Feb 2015 04:56:41 GMT</pubDate>
    <dc:creator>Matthew W.8</dc:creator>
    <dc:date>2015-02-09T04:56:41Z</dc:date>
    <item>
      <title>Dropbox chooser completion handler not firing</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85436#M2593</link>
      <description>&lt;P&gt;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.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;- (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;
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in my viewController.m&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-(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];


                                                             }


                       }

         }];

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 09:45:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85436#M2593</guid>
      <dc:creator>Matthew W.8</dc:creator>
      <dc:date>2019-05-29T09:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox chooser completion handler not firing</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85437#M2594</link>
      <description>&lt;P&gt;[Cross-linking for reference: &lt;A href="http://stackoverflow.com/questions/28390549/dropbox-chooser-completion-handler-not-firing" rel="nofollow noreferrer"&gt;http://stackoverflow.com/questions/28390549/dropbox-chooser-completion-handler-not-firing&lt;/A&gt; ]&lt;/P&gt;

&lt;P&gt;I believe the issue may be that you're essentially using two different Choosers in the different code snippets, i.e., by doing &lt;CODE&gt;[[DBChooser alloc] initWithAppKey&lt;/CODE&gt;... twice. Can you try it with a shared Chooser object, e.g., by doing &lt;CODE&gt;[[DBChooser alloc] initWithAppKey&lt;/CODE&gt;... just once and making the object available in both places ? (In the simple case, you would just use &lt;CODE&gt;[DBChooser defaultChooser]&lt;/CODE&gt;.)&lt;/P&gt;</description>
      <pubDate>Mon, 09 Feb 2015 04:27:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85437#M2594</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-02-09T04:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox chooser completion handler not firing</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85438#M2595</link>
      <description>&lt;P&gt;Nothing yet. I added @property DBChooser *chooser; to my viewController.h, and in my viewController.m I put:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_chooser = [[DBChooser alloc] initWithAppKey:@"ag56efd9sjxt8vv"];

        [_chooser 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];
                                                             }


                       }

         }];

}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in my AppDelegate.h I imported the ViewController.h and put in @property ViewController *viewController;&lt;/P&gt;

&lt;P&gt;and then in AppDelegate.m I have&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if ([self.viewController.chooser handleOpenURL:url]) {

        return YES;
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Same thing happens. It doesn't return to fire the completion handler.&lt;/P&gt;

&lt;P&gt;My permission is set for audio in the Dropbox app console. Not sure if that makes a difference&lt;/P&gt;</description>
      <pubDate>Mon, 09 Feb 2015 04:56:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85438#M2595</guid>
      <dc:creator>Matthew W.8</dc:creator>
      <dc:date>2015-02-09T04:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox chooser completion handler not firing</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85439#M2596</link>
      <description>&lt;P&gt;A correction on that last note. The permissions are simply Drop-ins. Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 09 Feb 2015 05:14:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85439#M2596</guid>
      <dc:creator>Matthew W.8</dc:creator>
      <dc:date>2015-02-09T05:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox chooser completion handler not firing</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85440#M2597</link>
      <description>&lt;P&gt;Thanks for trying that and following up. Can you try it with just &lt;CODE&gt;defaultChooser&lt;/CODE&gt; then? You actually don't need to have a separate Drop-ins app anymore anyway, since the key for your Sync API app can use Drop-ins too. (This wasn't always the case, which is why the documentation has the note about &lt;CODE&gt;initWithAppKey&lt;/CODE&gt;.)&lt;/P&gt;

&lt;P&gt;That is, as long as you have your Sync API app key registered in your URL scheme per the Sync API installation instructions, you can use &lt;CODE&gt;defaultChooser&lt;/CODE&gt; without having to store and share a Chooser object manually:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if ([[DBChooser defaultChooser] handleOpenURL:url]) {
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[[DBChooser defaultChooser] openChooserForLinkType:DBChooserLinkTypeDirect
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Feb 2015 09:39:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85440#M2597</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-02-09T09:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox chooser completion handler not firing</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85441#M2598</link>
      <description>&lt;P&gt;Thanks Greg. Yep, it does look like the single key I'm using for my sync works for the chooser as long as it's defaultChooser. I'll keep at it. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Feb 2015 10:02:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-chooser-completion-handler-not-firing/m-p/85441#M2598</guid>
      <dc:creator>Matthew W.8</dc:creator>
      <dc:date>2015-02-09T10:02:22Z</dc:date>
    </item>
  </channel>
</rss>

