loadPlayersForIdentifiers不接受我的数组

时间:2015-02-24 11:09:35

标签: ios gamekit

我有这个playerIDArray和Strings中的playerID,并给它loadPlayersForIdentifiers classMethod。但是当我打电话给这个方法时,我会收到一个错误。字符串不是零。我已经检查了这个。在我阅读的文档中,该方法需要一个带有playerID-Strings的数组。为什么这不起作用?

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);
        }

    }];

0 个答案:

没有答案