dropbox / dropbox-sdk-obj-c

Official Objective-C SDK for the Dropbox API v2.
MIT License
182 stars 117 forks source link

Show blank page when login. #182

Open ghost opened 6 years ago

ghost commented 6 years ago

the console log is "-canOpenURL: failed for URL: "dbapi-2://1/connect" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"and "-canOpenURL: failed for URL: "dbapi-8-emm://1/connect" - error: "The operation couldn’t be completed. (OSStatus error -10814.)""

greg-db commented 6 years ago

The canOpenURL 10814 errors themselves are expected if the official Dropbox app isn't installed, so they're safe to ignore. (The SDK checks if the official app is installed, and would use that for the authorization flow if it is. If it isn't though, it will fall back to an in-app flow.)

It sounds like you're getting a blank page when calling authorizeFromController though. That would be unrelated to the canOpenURL errors. This can occur when the controller passed to authorizeFromController isn't the topmost view controller. So, you instead just need to make sure you're passing in the top most view controller. This may depend on the exact view set up for your app, but for example it may look like this:

[DBClientsManager authorizeFromController:[UIApplication sharedApplication] controller:[UIApplication sharedApplication].keyWindow.rootViewController openURL:^(NSURL *url){
    [[UIApplication sharedApplication] openURL:url];
}];

If that doesn't seem to help, please share:

By the way, I deleted your second comment. In the future, please do not spam mention others. The Dropbox employees you mentioned do not work on the Objective-C SDK and won't be able to offer help with this issue. The people that can help regularly review newly posted issues and will reach out to offer help as I've done here. Thanks!

ghost commented 6 years ago

Thanks!

sdk version is 3.1.2 iOS 10.3 I tried the way you give me, but it was not working well.
i find a way ,that tap the setting and click safari and clear history and website data.then it works well... But when i click done button in web or unlink after login in ,this issue comes back.

ghost commented 6 years ago

- (BOOL) dropboxIsLinked { if ([DBClientsManager authorizedClient]) { return YES; } else { [self dismissPopoverAnimated:NO]; [DBClientsManager authorizeFromController:[UIApplication sharedApplication] controller:self openURL:^(NSURL *url) { [[UIApplication sharedApplication] openURL:url]; }]; return NO; } }

greg-db commented 6 years ago

Thanks! Version 3.1.2 is a bit old now though, and there have been various bug fixes since then, so please update to the latest version, currently v3.3.4 and let us know if you're still seeing the issue.

ghost commented 6 years ago

Thanks!
I have update the version to v3.3.4 ,but it doesn't work....maybe ,it's reason of the DBSafaricontroller 's webview cache. that , when i tap the setting and click the safari to clear the cache and website data ,it becomes well. a suggestion for you ...how to solve it ? maybe ,i would let my users to clear safari 's cache when the find this issue , now this is the only way for this issue ,i can't find another way...Waiting for you reply. Thank you again ,show enthusiasm for my question...

greg-db commented 6 years ago

Thanks! I can't seem to reproduce this.

What version(s) of iOS are you seeing this with? Does it reproduce for you in the DBRoulette example app?

kallipigous commented 6 years ago

I have exactly the same trouble. Works fine when dropbox app is installed but the web page loaded up is blank. This is a landscape only app incidentally. if I clear the cache in safari it pops up fine.

greg-db commented 6 years ago

@kallipigous Can you confirm you're passing in the topmost controller and are using the latest version of the SDK, per my earlier comments?

If so, please let me know what versions of iOS you're seeing this with, and if it reproduces with the example app.

kallipigous commented 6 years ago

Yup 'm passing the top controller and I'm using the most recent version of ios11.

I'll try with the example app.

kallipigous commented 6 years ago

I can confirm that dbroulette does work (though it just uses self for the viewcontroller) but the same code in my app does not. I get a white screen with a blank toolbar. When I clear the cache in safari and go back to my app it refreshes and appears.

greg-db commented 6 years ago

@kallipigous Thanks! To clarify though, I was referring to the latest version of the Dropbox SDK, not iOS itself.

Anyway, we haven't been able reproduce this version of this issue (where it's not about the view controller). That being the case, can you provide a small sample project that does reproduce it? That would be helpful in investigating. Thanks in advance!

kallipigous commented 6 years ago

I'll have a look though it will be difficult to parse out. For the time being I'll have to insist people have the dropbox app installed. I'll keep playing though and let you know if anything.

ghost commented 6 years ago

Thanks: The version is iOS 10 and Xcode is 8.It does’t reproduces in example app, just in my self. I have tried the way of that you have given to me — use topmost controller.

greg-db commented 6 years ago

@andywangzhen Thanks! As discussed with kallipigous, we haven't been able to reproduce this behavior, and since it doesn't reproduce for you in the example app, it does seem to be related to something specific to your app. I hate to be a bother, but that being the case, we will need a small sample project that reproduces the issue to be able to investigate further. If you would be able to supply one, that would be very helpful.

shriyaMadan commented 3 years ago

Is this issue still there?

greg-db commented 3 years ago

@shriyaMadan Unfortunately we were never able to reproduce the issue reported here. Are you seeing this issue yourself? If so, please share a sample project that demonstrates it so we can look into it.