游戏中心无法为多个玩家ID加载照片

Has*_*ral 6 iphone xcode center objective-c

我通过在函数中使用以下代码递归地在自定义排行榜中加载照片:

-(void)loadPhotos {
 [((GKPlayer*)[players objectAtIndex:i]) loadPhotoForSize:GKPhotoSizeSmall withCompletionHandler: ^(UIImage *photo, NSError *error) {

            if (error != nil)
            {

                NSLog(@"Error: %@", error);
            }
            if (photo != nil)
            {   

                [friendPhotos addObject:photo];
                [globalTable reloadData];
                i++;
                if (i< [players count]){
                    [self loadPhotos];
                }
            }
        }];
}
Run Code Online (Sandbox Code Playgroud)

我们目前正在两个设备上测试应用程序,因此我们在沙盒环境中有2个玩家.但是,第一个播放器的第一个呼叫加载照片,但第二张照片,我无法加载,我打印以下错误:

Error: Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo=0x1b19f0 {NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server.}
Run Code Online (Sandbox Code Playgroud)

有什么建议?

PS.也在循环中迭代地尝试了它.同样的错误,我认为这是因为我过于频繁地打电话.

Wil*_*sch 1

此类错误的一个可能原因是您没有启用正确的端口转发。请参阅此 Apple 文档