Game Center cannot upload photos for multiple player IDs

I upload photos to a custom leaderboard recursively using the 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 application on two devices, so we have 2 players in a sandbox environment. However, the first call for the first player loads the photo, but the second photo does not 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 this iteratively in a loop. The same mistake, and I thought it was due to the fact that I made calls too often.

+6
source share
1 answer

One possible reason for this type of error is that you did not enable proper port forwarding. See this Apple document .

+1
source

Source: https://habr.com/ru/post/903482/


All Articles