Ios LoadPlayerForIdentifiers将不接受我的数组
我有一个PlayerDarray,带有字符串中的playerID,并给它loadPlayerForIdentifiers类方法。但是当我调用这个方法时,我会得到一个错误。字符串不是零。我已经查过了。在我阅读的文档中,该方法需要一个带有playerID字符串的数组。为什么这不起作用Ios LoadPlayerForIdentifiers将不接受我的数组,ios,gamekit,Ios,Gamekit,我有一个PlayerDarray,带有字符串中的playerID,并给它loadPlayerForIdentifiers类方法。但是当我调用这个方法时,我会得到一个错误。字符串不是零。我已经查过了。在我阅读的文档中,该方法需要一个带有playerID字符串的数组。为什么这不起作用 NSArray * playersIDArray = @[ self.userIDString1, self.userIDString2, self.userIDString3, self.userIDString4
NSArray * playersIDArray = @[ self.userIDString1, self.userIDString2, self.userIDString3, self.userIDString4 ];
[GKPlayer loadPlayersForIdentifiers:playersIDArray withCompletionHandler:^(NSArray *players, NSError *error) {
if (players != nil) {
GKPlayer *playerGlobal1 = [players objectAtIndex:0];
GKPlayer *playerGlobal2 = [players objectAtIndex:1];
GKPlayer *playerGlobal3 = [players objectAtIndex:2];
GKPlayer *playerGlobal4 = [players objectAtIndex:3];
self.globalPlayersArray = @[ playerGlobal1, playerGlobal2, playerGlobal3, playerGlobal4 ];
NSLog(@"GKPLAYER ARRAY: %@",self.globalPlayersArray);
}
if (error) {
NSLog(@"ERROR: %@", error);
}
}];
发布您遇到的错误是一个非常好的开始。我从iphone中删除了该项目,然后再次运行,现在它工作了。。我不知道那是什么,但我没有改变我的密码。。这很奇怪。。也许我应该重新安装xcode。。几天以来,我遇到了越来越多的此类问题。不要重新安装Xcode,请查找clean and clean all。好的,我会这样做的,谢谢