Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Bob S.15
8 years agoCollaborator | Level 9
DropboxClientsManager authorizeFromController not doing anything
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.
...
- 8 years ago
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
Greg-DB
Dropbox Community Moderator
8 years agoOh, apologies, I didn't realize the second part was still Carthage output. Yes, in that case, please try removing the entire Carthage build of the SDK in that app and re-installing it.
Bob S.15
8 years agoCollaborator | Level 9
Okay. The Example app works fine.
I deleted the sdk's from my apps and re-downloaded. They update fine now.
I read the release notes, though -- you dropped support for iOS 8? So iOS9+ only? Too soon! I'm only just now dropping 7.
I set my cartfile to 3.0.11 which looks to be the one before you dropped iOS 8 support. Should that work, or have I got to drop 8 to continue using Dropbox?
But my god there are sure a lot of changes since I was working on this just a couple of months ago.
Here's one error I see a few times: "instance method -progress not found". This is in case like this one, where I was downloading a file:
[[[[DBClientsManager authorizedClient].filesRoutes downloadUrl:remotePath overwrite:NO destination: destURL]
setResponseBlock:^(DBFILESFileMetadata *result, DBFILESDownloadError *downloaderror, DBRequestError *error, NSURL *destination) {
if (result) {
NSLog(@"%@\n", result);
[brainpan loadedDropboxFile];
} else {
[brainpan loadDropboxFileFailed:(int)downloaderror.tag];
}
}] progress:^(int64_t bytesUploaded, int64_t totalBytesUploaded, int64_t totalBytesExpectedToUploaded) {
NSLog(@"\n%lld\n%lld\n%lld\n", bytesUploaded, totalBytesUploaded, totalBytesExpectedToUploaded);
}];If I look at the API documentation, the example for downloading a file looks a lot like mine:
http://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/index.html#download-style-request
[[[client.filesRoutes downloadUrl:@"/test/path/in/Dropbox/account" overwrite:YES destination:outputUrl]
setResponseBlock:^(DBFILESFileMetadata *result, DBFILESDownloadError *routeError, DBRequestError *networkError,
NSURL *destination) {
if (result) {
NSLog(@"%@\n", result);
NSData *data = [[NSFileManager defaultManager] contentsAtPath:[destination path]];
NSString *dataStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@\n", dataStr);
} else {
NSLog(@"%@\n%@\n", routeError, networkError);
}
}] progress:^(int64_t bytesDownloaded, int64_t totalBytesDownloaded, int64_t totalBytesExpectedToDownload) {
NSLog(@"%lld\n%lld\n%lld\n", bytesDownloaded, totalBytesDownloaded, totalBytesExpectedToDownload);
}];
Can you tell what I am doing wrong from what I've listed here?
Also, has the process for getting and saving OAuth2Tokens from OAuth1Tokens changed? That function you gave me, "
getAndSaveOAuth2TokensFromRetrievedOAuth1Tokens" has some errors, and in the documentation it looks like there is a whole new way of doing this: https://github.com/dropbox/dropbox-sdk-obj-c#migrating-oauth-tokens-from-earlier-sdks
Man this is kind of overwhelming, did I just pick the absolute wrong time to upgrade Dropbox back in January, like a week before you guys decided to change everything in the SDK?
Thanks
Bob
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!