You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Samnis
5 years agoExplorer | Level 4
Objective-C SDK crash
Hi,
in my project I am using the Objective-C SDK: I am updating the app to use scopes and short lived tokens. I added the SDK to the project by manually copying all the classes.
I am getting ...
Samnis
Explorer | Level 4
Yes, I installed it by manually following the steps of the pod file of the "CocoaPods" installation method.
Yes, the crash occurs during the "handle redirect back into SDK". The code I use for managing the redirect is the following (it is a method of the app delegate):
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options { DBOAuthCompletion completion = ^(DBOAuthResult *authResult) { if (authResult != nil) { if ([authResult isSuccess]) { // update the flag self.automaticallyUpdateDropboxInfo = YES; } else if ([authResult isCancel]) { // log // ... } else if ([authResult isError]) { // log // ... } } }; BOOL canHandle = [DBClientsManager handleRedirectURL:url completion:completion]; return canHandle; }
I also add the code I use to begin the authorization flow. I don't think it is the problem, but who knows... The code is the following:
- (void)linkUser { DBScopeRequest *scopeRequest = [[DBScopeRequest alloc] initWithScopeType:DBScopeTypeUser scopes:@[@"account_info.read", @"files.metadata.read", @"files.metadata.write", @"files.content.read", @"files.content.write"] includeGrantedScopes:NO]; [DBClientsManager authorizeFromControllerV2:[UIApplication sharedApplication] controller:[self getRootViewController] loadingStatusDelegate:nil openURL:^(NSURL *url) { [[UIApplication sharedApplication] openURL:url options:[NSDictionary dictionary] completionHandler:nil]; } scopeRequest:scopeRequest]; }
Please help, I am stuck on this since a week... Thank you very much,
Mario
Samnis
5 years agoExplorer | Level 4
PS: I have installed the Dropbox app into my device, and I am logged into it. So the official Dropbox app takes part to the authentication flow.
Hope this helps,
Mario
- Greg-DB5 years agoDropbox Staff
Thanks! This all looks correct. I also just tried copying these snippets into my own sample project here though to be sure, but I still can't reproduce the issue. (And I also have the official Dropbox iOS app installed, handling the app authorization flow.)
Also, just to confirm, you're calling DBClientsManager setupWithAppKey in didFinishLaunchingWithOptions, right?
It's unclear why this would be occurring, as these unexpected classes (NSSQLiteStatementCache, NSContentSizeLayoutConstraint, and UICTFontDescriptor) seem to be from system frameworks (such as Core Data and Foundation). The Dropbox Objective-C SDK doesn't reference these classes at all.
A few more things to try to narrow this down:
- Is this reliably reproducible for you, or does it only happen on random attempts?
- Have you tried this on multiple devices? Have you tried it in the simulator?
- Have you tried completely uninstalling and reinstalling the Dropbox SDK?
- Do you have any non-standard project settings? Does this also occur for you if you set it up in a new project?
- Samnis5 years agoExplorer | Level 4
Thank you very much, Greg.
In the following days I'll try all the things you suggested. And I'll let you know.
Thank you again,
Mario
- Samnis4 years agoExplorer | Level 4
Hi Greg, some updates:
- Now it works: to fix the problem I completely uninstalled the Dropbox SDK and reinstalled it with Cocoapods. Nothing else worked.
- I am calling DBClientsManager.setupWithAppKey in app delegate "applicationDidBecomeActive:", but this shouldn't be a problem.
- The crash was 100% reproducible. I tried it on multiple devices, iPhones and iPads, and it crashed every time.
Thank you very much for your help :-)
Mario
- Samnis4 years agoExplorer | Level 4
Another question: if I update the configuration of my production app to use scopes and short-lived tokens, what happens to users who never update the app? Will they be able to connect the app to Dropbox in following weeks, or they will get an error? And what will happen after September 30, 2021?
Thank you,
Mario
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,917 PostsLatest Activity: 11 days ago
If you need more help you can view your support options (expected response time for an email or 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!