Game Center Error - iphone

I am following a tutorial here . Multiplayer Game iOS
I am using following code from above tutorial for Match Making
GKMatchRequest *request = [[[GKMatchRequest alloc] init] autorelease];
request.minPlayers = minPlayers;
request.maxPlayers = maxPlayers;
request.playersToInvite = pendingPlayersToInvite;
GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithMatchRequest:request] autorelease];
mmvc.matchmakerDelegate = self;
[presentingViewController presentModalViewController:mmvc animated:YES];
When I search for other players using Play Now option, the GKMatchmakerViewController dismissed immediately delegating matchmakerViewController:didFailWithError with following error.
Error Domain=GKErrorDomain Code=3 "The requested operation could not be
completed due to an error communicating with the server." UserInfo=0x2081d8d0
{GKServerStatusCode=5001, NSUnderlyingError=0x2086c560 "The operation couldn’t be
completed. (GKServerErrorDomain error 5001.)", NSLocalizedDescription=The requested
operation could not be completed due to an error communicating with the server.}
I have not been able to figure why is it happening so. The same code was previously able to search and find appropriate players but failed when fetching player aliases using
[GKPlayer loadPlayersForIdentifiers:match.playerIDs withCompletionHandler:^(NSArray *players, NSError *error)
with 'Could not communicate to server' error.
The code however, works fine on simulator.

I also got
Error Domain=GKErrorDomain Code=3 "The requested operation could not
be completed due to an error communicating with the server."
UserInfo=0x17007e4c0 {GKServerStatusCode=5001,
NSLocalizedDescription=The requested operation could not be completed
due to an error communicating with the server.,
NSUnderlyingError=0x170050140 "The operation couldn’t be completed.
(GKServerErrorDomain error 5001.)
I think this is sandbox.gc.apple.com problem..
this question is one year but apple still have this problem sometime
Wish apple fix this soon.
I try on iPod touch and I got
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
UserInfo=0x176bec90
{NSErrorFailingURLKey=http://sandbox.gc.apple.com/WebObjects/GKInit.woa/wa/getBag?ix=1,
NSErrorFailingURLStringKey=http://sandbox.gc.apple.com/WebObjects/GKInit.woa/wa/getBag?ix=1,
NSLocalizedDescription=The request timed out.}

Having the same problem (GKServerStatusCode=5001) when sending new high score using reportScoreWithCompletionHandler.
In sandbox mode all is OK, but AppStore version has this issue on all devices where sandbox mode was enabled (iOS 8.2 / 8.3). But I can see data from other users in leaderboards. Looks like this is actually bug on Apple's side.

Related

Custom OpenGraph methods failing when posting

I am getting the following error when attempting to post to OpenGraph using the Share Dialog with the FB iOS SDK v 3.17.0.:
Error : Error Domain=com.facebook.Facebook.platform Code=102 "The operation couldn’t be completed. (com.facebook.Facebook.platform error 102.)" UserInfo=0x176d43a0 {error_code=102, error_description=An error occurred during publishing., app_id=xxxxxxxxxxx, error_reason=The operation couldn’t be completed. (FBAPIErrorDomain error 2500.)}
This error is returned by handler callback of the presentShareDialogWithOpenGraphAction method. When calling this method, the transition to the FB App occurs and the contents of the post are shown in the UI (although, the supplied photo shows briefly and then disappears). I also see an alert dialog in the FB App stating:
Oops, Something Went Wrong. There was a problem posting your status. We've logged the error and will look into it.
After pressing Post in the FB app, my app opens again with the above error message.
The (abbreviated) code for what I am doing is below. Note that my object type is gift, my custom method is send, and both appear to be set up correctly on the developer site. Any help is much appreciated.
id<FBGraphObject> object = [FBGraphObject openGraphObjectForPostWithType:#"myNamespace:gift"]
title:#"Gifter"
image:#"http://imgur.com/gallery/Omhe1V3"
url:#"http://www.myAppsUrl.com"
description:#"A gift for you"];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:object forKey:#"gift"];
[action setTags:#[targetFacebookId]]; ///S.O. Note: The Id is obtained elsewhere.
FBOpenGraphActionParams *params = [[FBOpenGraphActionParams alloc] init];
params.action = action;
params.actionType = #"myNamespace:send";
// If the Facebook app is installed and we can present the share dialog
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]) {
// Show the share dialog
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:#"myNamespace:send"
previewPropertyName:#"gift"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
NSLog(#"Error : %#",error);
}];
}
Look carefully on the parameters you provide. FB doesn't tell you what's wrong but just returns this general error.
I just had the same problem and apparently my namespace was wrong.
So my suggestion - double and triple check all the params you are passing to FB

Facebook posting error in ios

Here i am trying to add a post to facebook using following code.
FBAppCall *appCall = [FBDialogs presentShareDialogWithLink:urlToShare
name:#"Title"
caption:nil
description:#"description"
picture:nil
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if (error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
But this isn't working. It give following error.
Error Domain=com.facebook.Facebook.platform Code=102 "The operation couldn’t be completed. (com.facebook.Facebook.platform error 102.)" UserInfo=0x1cde3340 {error_code=102, action_id=E780C3AA-1387-4B9C-9A3A-9A16FB54BC59, error_message=An error occurred during publishing., app_id=558567750859724}
Here i am working on cocos2d, is this can be the reason.
Go to your app's settings under the Facebook developer portal.
Go to open graph > types
Choose the action type using and turn on "User Generated Images" for that action type. Save these settings and try again. It will work.
I encountered this error as well, make sure you disable the sandbox mode in Facebook admin panel before distributing to any other user :P
I recently encountered this error when the link I tried to post did not load correctly (was loading a 404 page). Not sure why, but maybe Facebook requires the link work.. Either way they need to make their error messaging more specific.

Facebook image upload on a page working properly in simulator but not in device

When I run same code in simulator I get success Response for image post:
{
id = 248572435289479;
"post_id" = "244759709004085_248572441956145";
}
When I run in same code in device I get:
Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x208a8dd0 {error={
code = 1;
message = "(#1) An unknown error occurred";
type = OAuthException;
}}
"
OAuthException means that there was an authentication issue. Be sure that the following are true on your device.
You are logged into a facebook account successfully
If you are, then remove the app from the phone
Do a clean and re-deploy to the phone
If none of the above work, try logging out in Settings on the phone and logging back in. Then try logging in through safari. Sometimes the iOS facebook authentication can be a little buggy. Also try a different app that is guaranteed to work with iOS facebook accounts. Something like, Hootsuite.
If there is still an issue after all that... I am not sure what you tell you.
This link might help you.
and #giff's answer also explains it to some extent on this link.
log of your issue in this might help you to get further detail of your error.
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
NSLog(#"%#", [error localizedDescription]);
NSLog(#"Err details: %#", [error description]);
};
I recommend you to try this if none of the solutions given above could help you.
Remove the application from the list of authorized applications and authorize it again with the needed permissions.
Hope this works for you

Not sending turn with GKTurnBasedParticipant IOS 5 iphone

I am developing an app for iPad and iPhone with the Game Center Feature. The game is sending correctly one participant turns from iPad 2 IOS 6, but when I try to send the turn to another participant from an iPhone 4 IOS 5 the following error appears:
<GKTurnBasedParticipant 3d8e50 - id:(null) status:Matching outcome:None lastTurn:(null)>
2013-03-14 23:56:22.030 [453:707] ERROR::::::Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo=0x7a81170 {NSUnderlyingError=0x3f4220 "The operation couldn’t be completed. status = 5008, missing required key: turns", NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server.}
2013-03-14 23:56:22.031 [453:707] Oops, there was a problem. Try that again.
I am using the following method that works perfectly on IOS 6:
[currentMatch endTurnWithNextParticipant:nextParticipant
matchData:data completionHandler:^(NSError *error) {
if (error) {
NSLog(#"%#", error);
NSLog(
#"Oops, there was a problem. Try that again.");
} else {
NSLog(#"Your turn is over.");
}
}];
The error number 3 is GKErrorCommunicationsFailure,but I cant understand what it is going on!
I logged on correctly when the app starts with the Game Center
This error will always come when you are working on Simulator instead of device, but sometimes it pops out on device, because of Push Notification Failure,
Please check if you device is receiving Push Notifications.
UPDATED
I recently figured it out that Game Center does not send push notifications to devices which does not have sim card inserted

iPhone GameKit: Communication with Sandbox - GKErrorDomain Code 3

Anyone has any experience with GameKit GKErrorDomain Code 3? I receive the error message when I try to upload a score to a leaderboard in the Sandbox. The iOS reference library just says that Indicates that an error occurred when communicating with Game Centre The Here is the full error message:
Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo=0x75e4eb0 {NSUnderlyingError=0x7531e00 "The operation couldn’t be completed. status = 5053", NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server
The environment:
The request is being made from the 4.1 Simulator
GameKit has authenticated the local player who has logged into the Sandbox
The leaderboard with the name "Standard" has been created on iTunes connect
I can browse the web in the simulator
Here is the code I use to upload the score
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:#"Standard"] autorelease];
scoreReporter.value = 10;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error)
{
if (error != nil)
{
// handle the reporting error
NSLog(#"An error occured reporting the score");
}
else
{
NSLog(#"The score was reported successfully");
}
}];
One reason (which is the reason that was affecting me) for GKDomainError Code 3 is if the Leaderboard Category Id specified in the initWithCategory message when initializing GKScore is incorrectly specified.
It's easier to track down if you print out the error.
Etc:
NSLog(#"An error occured reporting the score: %#", error);