2

i am trying to create an event but getting error . i am writing following code to create event using facebook sdk 3.1

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"My Test Event",@"name",
                               @"Bangalore",@"location",
                               @"1297641600",@"start_time",
                               @"1297468800",@"end_time", nil];

NSString * pRequest = [NSString stringWithFormat:@"me/events"];

[FBRequestConnection startWithGraphPath:pRequest parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

     if (!error)
     {
        NSLog(@"Facebook Post Success..");

    } else
    {
        NSLog(@"Facebook Post Failed..");

        NSLog(@"ERROR : %@", error.localizedDescription);
    }

}];

error :

Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xa180200 {com.facebook.sdk:ParsedJSONResponseKey={
    body =     {
        error =         {
            code = 100;
            message = "(#100) Invalid parameter";
            type = OAuthException;
        };
    };
    code = 400;
}, com.facebook.sdk:HTTPStatusCode=400}

can anybody help .....

thanks in advance

Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70
  • 1
    It can be several things. But the HttpStatusCode is pretty obvious 400 means a Bad Request. And as the Facebook error sugest there is an invalid parameter. Make sure all the parameters are right that you pass through. Look into the documentation too make sure. Also Facebook 5 error can suggest that you try to post or create an event in a short time. There is a limit for this. So make sure the event is not already there. – QVDev Apr 08 '13 at 07:21
  • thank's ... the time parameter was wrong ..... now it's working fine – Shaik Riyaz Apr 09 '13 at 12:15
  • Cool, then maybe you can expect it as an answer too, and maybe add a comment on what exactly was wrong with the time parameter. Thanks! – QVDev Apr 09 '13 at 12:36

1 Answers1

1

The error is a 400 error a bad request. This means there is something wrong with you're request. Also the error that Facebook returns suggest that you have an invalid parameter. So I suggest to double check you're parameters that you are sending and make sure you sending the correct amount of parameters in the right order and the right values.

QVDev
  • 1,093
  • 10
  • 17