Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Game Center Can't Load Photos for several player IDs

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.

like image 239
Hasan Can Saral Avatar asked Dec 09 '11 21:12

Hasan Can Saral


1 Answers

One possible cause of this type of error is that you haven't enabled the correct port forwarding. See this Apple doc.

like image 104
William Jockusch Avatar answered Oct 05 '22 04:10

William Jockusch