iOS Google+ Safari cannot open page because address is invalid

笑着哭i 提交于 2019-12-18 14:13:12

问题


I have two apps one is free and another is paid version. I have implemented google+ share on paid and its working fine. But when I copied code to my free version it doesn't work. I have one Google apis project and added two clients for both iOS apps.

I get "Safari cannot open page because address in invalid" erro after sharing or cancel and it does not open my app.

Please help

I followed all steps defined at https://developers.google.com/+/mobile/ios/share#detecting_if_a_post_was_successfully_shared


回答1:


Add this method into your appdelgate

  - (BOOL)application:(UIApplication *)application
        openURL:(NSURL *)url
 sourceApplication:(NSString *)sourceApplication
     annotation:(id)annotation {
NSLog(@"%@",sourceApplication);


// Handle Google+ sign-in button URL.
if ([signInButton_ handleURL:url
           sourceApplication:sourceApplication
                  annotation:annotation]) {
    return YES;
}



 return NO;
}



回答2:


Make sure that you add a URL Type for your app and that it matches the bundle ID of your app. I made a typo in specifying the URL and it took me a while to figure out why it wasn't working. https://developers.google.com/+/mobile/ios/getting-started#step_3_add_a_url_type




回答3:


For this we have to add URL schemes and identifier value in ProjectName - settings tab - info tab - URL Types tab.

Like in the below screenshot



来源:https://stackoverflow.com/questions/17080335/ios-google-safari-cannot-open-page-because-address-is-invalid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!