我通过在函数中使用以下代码递归地在自定义排行榜中加载照片:
-(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];
}
}
}];
}
我们目前正在两台设备上测试该应用,因此我们在沙箱环境中有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.}
有什么建议吗?
聚苯乙烯。也在循环中迭代地尝试了它。同样的错误,我认为这是因为我过于频繁地打电话。