Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello,
I'm having trouble presenting the Dropbox login to the user. I had it working some time ago, but today I tried it and nothing happens. I make this call and nothing happens.
[DropboxClientsManager authorizeFromController:[UIApplication sharedApplication] controller:VC openURL:^(NSURL *url) { [[UIApplication sharedApplication] openURL:url]; } browserAuth:NO];
I've tried it with browserAuth set to YES too, and get the same problem. Has anything changed recently?
I don't see any errors or any text at all on the console. Any idea what could be the problem?
Thanks
Bob
I see. So what would I put in the CartFile to make it download version 3.0.11, to continue supporting iOS 8?
Based on the Cartfile documentation, it looks like the operator for that is "==", so you'd need "== 3.0.11".
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
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
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
Huh - I don't get anything. I wonder if I have exceptions turned off somehow?
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.
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
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!