Facebook iOS SDK 3.1: "Error: HTTP status code: 400" Facebook iOS SDK 3.1: "Error: HTTP status code: 400" ios ios

Facebook iOS SDK 3.1: "Error: HTTP status code: 400"


Right after the session is created do this:

[FBSession setActiveSession:session];


As best as I can tell, this is a bug introduced in the 3.1 SDK. Looking at the network traffic with Charles, they’re trying to POST to graph.facebook.com/[user id]/activities but it’s failing.


After much troubleshooting and looking at all the suggestions on Stackoverflow, I got this error 400 (error.code = 5) thing resolved.The solution in my case was to make sure the params (aka postParams) included in my startWithGraphPath call had exactly the params supported by the type of content being posted.

More specifically, I was posting a link to me/feed with the @"ref" key (typically used for tracking with FB Insights).

After removing the @"ref" key, startWithGraphPath succeeded.

NSMutableDictionary *postParams = [NSMutableDictionary dictionaryWithObjectsAndKeys:                                   @"Test NAME field (from ios app)", @"name",                                   @"Test caption", @"caption",                                   @"Test description", @"description",                                   @"http://example.com/test1.html", @"link",                                   @"http://example.com/water.jpg", @"picture",                                   // @"foo", @"ref",  // WRONG!                                   nil];[FBRequestConnection startWithGraphPath:@"me/feed"                             parameters:postParams                             HTTPMethod:@"POST"                      completionHandler:^(FBRequestConnection *connection,                                          id result,                                          NSError *error)

My activeSession (and all other possible culprits) checked-out OK.