ios - Google Play 游戏在 iOS 上登录错误

标签 ios google-play-games google-signin

您好,我正在尝试在我的 iOS 应用程序上登录 Google Play 游戏。 我已经手动安装了 sdk,并按照 google 网站上的入门教程所说的做了所有事情。 但是,当我单击登录按钮时,应用程序会将我带到 safari,并且我会在控制台中收到这些消息:

2016-08-14 14:32:26.450 פקודה![34477:5811630] -canOpenURL: failed for URL: "com.google.gppconsent.2.4.1://" - error: "This app is not allowed to query for scheme com.google.gppconsent.2.4.1"
2016-08-14 14:32:26.452 פקודה![34477:5811630] -canOpenURL: failed for URL: "com.google.gppconsent.2.4.0://" - error: "This app is not allowed to query for scheme com.google.gppconsent.2.4.0"
2016-08-14 14:32:26.454 פקודה![34477:5811630] -canOpenURL: failed for URL: "com.google.gppconsent.2.3.0://" - error: "This app is not allowed to query for scheme com.google.gppconsent.2.3.0"
2016-08-14 14:32:26.455 פקודה![34477:5811630] -canOpenURL: failed for URL: "com.google.gppconsent.2.2.0://" - error: "This app is not allowed to query for scheme com.google.gppconsent.2.2.0"
2016-08-14 14:32:26.456 פקודה![34477:5811630] -canOpenURL: failed for URL: "com.google.gppconsent://" - error: "(null)"
2016-08-14 14:32:26.457 פקודה![34477:5811630] -canOpenURL: failed for URL: "hasgplus4://" - error: "(null)"
2016-08-14 14:32:26.486 פקודה![34477:5811630] -canOpenURL: failed for URL: "googlechrome-x-callback:" - error: "(null)"
2016-08-14 14:32:26.487 פקודה![34477:5811630] -canOpenURL: failed for URL: "googlechrome:" - error: "(null)"

即使在我点击了允许权限后,它也会将我带回我的应用程序,但即使是 func 也没有任何反应:

- (void)didFinishGamesSignInWithError:(NSError *)error {
    if (!error)
    NSLog(@"GooglePlayGames finished signing in!");
    else
    NSLog(@"***Error signing in! %@", [error localizedDescription]);

}

根本没有被调用。请帮忙

这就是我的登录代码:

- (void)viewDidLoad
{
    [super viewDidLoad];

    [GIDSignIn sharedInstance].clientID = kClientID;
    [GPGManager sharedInstance].statusDelegate = self;
    [GIDSignIn sharedInstance].uiDelegate = self;

    _currentlySigningIn = [[GPGManager sharedInstance] signInWithClientID :kClientID silently:YES];
}

# pragma mark -- GIDSignInUIDelegate methods

- (void)signIn:(GIDSignIn *)signIn
didSignInForUser:(GIDGoogleUser *)user
     withError:(NSError *)error
{
    NSLog(@"%@",user);
}


# pragma mark -- GPGStatusDelegate methods

- (void)didFinishGamesSignInWithError:(NSError *)error {
    if (!error)
    NSLog(@"GooglePlayGames finished signing in!");
    else
    NSLog(@"***Error signing in! %@", [error localizedDescription]);

}
- (void)didFinishGamesSignOutWithError:(NSError *)error {
    if (error)
        NSLog(@"Received an error while signing out %@", [error localizedDescription]);
     else
        NSLog(@"Signed out!");
}

- (IBAction)signInButtonWasPressed:(id)sender {
    [[GPGManager sharedInstance] signInWithClientID:kClientID silently:NO];
}

- (IBAction)signOutButtonWasPressed:(id)sender {
    [[GPGManager sharedInstance] signOut];
}

最佳答案

这是我发现的关于 “不允许此应用程序查询方案” 的内容。

我认为这是由于新 ios 版本 ios9 的更改所致。

在这个 blog 上找到这个.

The key bits regarding changes to URL schemes in iOS 9 is the Privacy and Your Apps session, starting at around the 9 minute mark under the heading “App Detection”.

There are two URL-related methods available to apps on iOS that are effected: canOpenURL and openURL. These are not new methods and the methods themselves are not changing. As you might expect from the names, “canOpenURL” returns a yes or no answer after checking if there is any apps installed on the device that know how to handle a given URL. “openURL” is used to actually launch the URL, which will typically leave the app and open the URL in another app.

检查此SO thread中的代码实现了解更多信息。

关于ios - Google Play 游戏在 iOS 上登录错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38942020/

相关文章:

ios - 为什么我的类继承自 UIDynamicAnimator 不能使用 addChildBehavior

ios - 禁用 UITableView 水平滚动

android - GMS 11.0.0之后如何选择TurnBaseMatches的对手?

android - Google Play 游戏服务 - 从横向模式的应用启动 google+ 登录流程

android - 如何将额外数据与从 GoogleSignInClient.getSignInIntent() 获得的 Intent 一起传递?

ios - 想法如何使用 IOS 的 opencv 测量检测到的物体与相机的距离?

ios - 图像未显示在 UITabBarItem 中

android - GPGS 附近连接 : Is it valid to advertise and discover at the same time?

javascript - 使用 javascript 的 Google 登录(网站)

Android:谷歌登录切换到其他 Activity 而不会丢失登录数据