I am getting the following error when trying to post to the user's Facebook wall and I can't seem to find the source. Anyone have some insight on this issue?
2012-08-29 22:14:38.490 CanP[405:707] Error: HTTP status code: 400
2012-08-29 22:14:38.494 CanP[405:707] FBSDKLog: Response <#1111> <Error>:
The operation couldn’t be completed. (com.facebook.sdk error 5.)
The method that is run that should post the message to the facebook wall is as follows:
[FBSettings setLoggingBehavior:[NSSet setWithObjects:
FBLoggingBehaviorFBRequests,
nil]];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
[defaults synchronize];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"My test app", @"name",
@"http://www.google.com", @"link",
@"FBTestApp app for iPhone!", @"caption",
@"This is a description of my app", @"description",
@"Hello!\n\nThis is a test message\nfrom my test iPhone app!", @"message",
nil];
// Publish.
// This is the most important method that you call. It does the actual job, the message posting.
[facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];
As suggested by C Abernathy, you should "place a breakpoint at the error line and take a look at the error variable then drill down to a dictionary named userInfo that should contain a much more readable error message."
For those of us testing a new Facebook integration, the most common problem is likely to be shown in the error.userInfo "com.facebook.sdk.ParsedJSONResponseKey":
message = "(#506) Duplicate status message";
Vary the text you use to test your Facebook integration, and you may find that your code is working just fine!
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