问题
Obviously I must be missing something.
When I press my Google + button, it opens up safari and prompts for the login. Everything is fine until I complete the login procress. Safari tells me "Cannot open the Page -- Safari cannot open the page because the address is invalid". It never takes me back to my app, but keeps Safari open and goes to google.com.
I was thinking this would take care of that, but break points aren't ever going off in this method. Maybe I'm misunderstanding how it works.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];
}
Thanks for any help you can provide
回答1:
Take look to the Bundle Identifier that is in your project and that you have registered with https://code.google.com/apis/console . Both of them should be same. After that make sure also you have set that same URL Schemes in URL Types in your application plist file.
回答2:
I had this same problem today. I finally compared the sample app (included w/ SDK) line by line before I figured my problem out.
I didn't realize the ClientID found in the Developers Console was in standard domain name order while the URL Scheme for 1 of the 2 URL Types in the project settings (Info.plist) needs to be in reverse domain name notation
ClientID in Developers Console is [guid].apps.googleusercontent.com
URL Scheme in Info.plist is com.googleusercontent.apps.[guid]
来源:https://stackoverflow.com/questions/18092644/google-plus-api-doesnt-return-to-app-on-login