I am loading photos in a custom leaderboard recursively by using following code in a function:
-(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];
}
}
}];
}
We are currently testing the app in two devices so we have 2 players in our sandbox environment. However first call for the first player loads the photo but the second photo, I cannot load, and I print the following error:
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.}
Any suggestions?
Ps. Also tried it iteratively in a loop. Same error, and I thought it was due to I was making calls too frequently.
One possible cause of this type of error is that you haven't enabled the correct port forwarding. See this Apple doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With