cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to make sure we keep you updated on the ideas that other users have shared here on the Community? Us too! Check them out over here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Comments

Re: DropboxClientsManager authorizeFromController not doing anything

Re: DropboxClientsManager authorizeFromController not doing anything

Bob S.15
Collaborator | Level 8

I see.  So what would I put in the CartFile to make it download version 3.0.11, to continue supporting iOS 8?

Re: DropboxClientsManager authorizeFromController not doing anything

Greg-DB
Dropboxer

Based on the Cartfile documentation, it looks like the operator for that is "==", so you'd need "== 3.0.11".

Re: DropboxClientsManager authorizeFromController not doing anything

Bob S.15
Collaborator | Level 8

Hey Greg,

 

    Finally found it.  I was skipping the call to DBClientsManager setupWithAppKey!  It was in there, but I was mistakenly skipping it when my app had stored the preference that Dropbox was disconnected.  It's weird that that produces no error messages.  I found the problem by stepping in the debugger into authorizeFromController and noticing that both my sharedApplication and controller arguments were 'nil', even though they were valid values when I passed them.  Then I noticed the assert in that function:

 

 NSAssert([DBOAuthManager sharedOAuthManager] != nil,
           @"Call `Dropbox.setupWithAppKey` or `Dropbox.setupWithTeamAppKey` before calling this method");

As soon as I saw that, I knew what I had done.

 

I guess that the assert never fired, because [DBOAuthManager sharedOAuthManager] is a valid number even if you have not called setupWithAppKey?

 

Anyway thanks for helping me with this problem, I really appreciate it.  I'll probably run into more but at least this one is down.

Bob

 

Re: DropboxClientsManager authorizeFromController not doing anything

Greg-DB
Dropboxer
Great! I'm glad to hear you tracked this down. I'll ask the team to see if we can make this fail more noisily in that case.

Re: DropboxClientsManager authorizeFromController not doing anything

Greg-DB
Dropboxer
I'm trying to reproduce this, but in my simple test project I am getting that assert exception thrown when omitting setupWithAppKey and then calling authorizeFromController.

To help us reproduce this, do you know how your app got into a state where [DBOAuthManager sharedOAuthManager] wasn't nil? What was the value of [DBOAuthManager sharedOAuthManager] in that case?

Re: DropboxClientsManager authorizeFromController not doing anything

Bob S.15
Collaborator | Level 8

Hey Greg,

 

  Well, I could swear I checked the value of sharedOAuthManager and it was nonzero, but now it shows zero when I do not call setupWithAppKey.  However, it doesn't make any difference - even when it is zero, I still don't see any error message.  I tried it with DBRoulette and got the same results.

 

What happens for you when that assert fires?  Does that text print out in the console?

 

Bob

 

 

Re: DropboxClientsManager authorizeFromController not doing anything

Greg-DB
Dropboxer

I do get an exception thrown with the message:

 

*** Assertion failure in +[DBClientsManager authorizeFromController:controller:openURL:], test_project/Pods/ObjectiveDropboxOfficial/Source/ObjectiveDropboxOfficial/Platform/ObjectiveDropboxOfficial_iOS/DBClientsManager+MobileAuth-iOS.m:20
2017-04-19 11:40:19.423 test_project[44538:72659315] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Call `Dropbox.setupWithAppKey` or `Dropbox.setupWithTeamAppKey` before calling this method'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010e14ab0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010d50c141 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010e14ecf2 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x000000010b63a3b6 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
    4   test_project                        0x000000010b01bb69 +[DBClientsManager(MobileAuth) authorizeFromController:controller:openURL:] + 393
    5   test_project                        0x000000010b011a3f -[ViewController didPressLink:] + 223
    6   UIKit                               0x000000010bca9d22 -[UIApplication sendAction:to:from:forEvent:] + 83
    7   UIKit                               0x000000010be2e25c -[UIControl sendAction:to:forEvent:] + 67
    8   UIKit                               0x000000010be2e577 -[UIControl _sendActionsForEvents:withEvent:] + 450
    9   UIKit                               0x000000010be2d4b2 -[UIControl touchesEnded:withEvent:] + 618
    10  UIKit                               0x000000010bd1749a -[UIWindow _sendTouchesForEvent:] + 2707
    11  UIKit                               0x000000010bd18bb0 -[UIWindow sendEvent:] + 4114
    12  UIKit                               0x000000010bcc57b0 -[UIApplication sendEvent:] + 352
    13  UIKit                               0x000000010c4a8adc __dispatchPreprocessedEventFromEventQueue + 2926
    14  UIKit                               0x000000010c4a0a3a __handleEventQueue + 1122
    15  CoreFoundation                      0x000000010e0f0c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    16  CoreFoundation                      0x000000010e0d60cf __CFRunLoopDoSources0 + 527
    17  CoreFoundation                      0x000000010e0d55ff __CFRunLoopRun + 911
    18  CoreFoundation                      0x000000010e0d5016 CFRunLoopRunSpecific + 406
    19  GraphicsServices                    0x0000000113a2ba24 GSEventRunModal + 62
    20  UIKit                               0x000000010bca80d4 UIApplicationMain + 159
    21  test_project                        0x000000010b01220f main + 111
    22  libdyld.dylib                       0x000000010effa65d start + 1
    23  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Re: DropboxClientsManager authorizeFromController not doing anything

Bob S.15
Collaborator | Level 8

Huh - I don't get anything.  I wonder if I have exceptions turned off somehow?

Re: DropboxClientsManager authorizeFromController not doing anything

Bob S.15
Collaborator | Level 8

I tried putting that exception in the main body of DBRoulette, right after the commented out setupWithAppKey line, and it terminated with the same error you got.  But it doesn't seem to fire within the SDK library.  Probably unrelated, but it also seems weird to me that when I step into that function, my controller and  [UIApplication sharedApplication] arguments show up as nil in the debugger.

Re: DropboxClientsManager authorizeFromController not doing anything

Bob S.15
Collaborator | Level 8

Hey Greg,  here is my DBRoulette project, in case you want to try it out.  I'd be curious to know whether the assert fires for you.

 

https://www.dropbox.com/s/teyv6nmhhyfmzyu/dropbox-sdk-obj-c-master.zip?dl=0

Need more support?