您好我想在我的iOS应用上登录谷歌玩游戏。我手动安装了sdk并完成了所有操作,因为谷歌网站上的入门教程说。但当我点击登录按钮时,应用程序将我带到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上找到了这个。
有关iOS 9中URL方案更改的关键位是“隐私和您的应用”会话,从“App Detection”标题下的9分钟左右开始。
iOS上的应用程序可以使用两种与URL相关的方法:canOpenURL和openURL。这些不是新方法,方法本身也没有改变。正如您对名称所期望的那样,“canOpenURL”在检查设备上是否安装了知道如何处理给定URL的应用程序后返回是或否答案。 “openURL”用于实际启动URL,该URL通常会离开应用程序并在另一个应用程序中打开URL。
有关详细信息,请查看此SO thread中的代码实现。