0

I am currently developing a game which will not have a canvas version. It will be playable on iOS and Android platform.I need to work with game achievement objects. I followed Facebook Graph API for creating Achievement . I could not understand the meta tag <meta property="og:url" content="Put your own URL to the object here" />. What I actually did is I started my own server and created an .html file with the content as shown in Mark Up Section. I replaced the Put your own URL to the object here with http://192.168.2.6:8888/facebooktest/achivement.html. The code I used

    - (IBAction)updateAchivement:(id)sender {

        NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"****888****3612", @"fb:app_id",
                            @"game.achievement", @"og:type",
                            @"http://192.168.2.6:8888/facebooktest/achivement.html", @"og:url",
                            @"Sample Game Achievement", @"og:title",
                            @"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png", @"og:image",
                            @"1000", @"game:points",
                            nil
                            ];

    /* make the API call */
    [FBRequestConnection startWithGraphPath:@"/me/objects/" //game.achievement
                                 parameters:params
                                 HTTPMethod:@"POST"
                          completionHandler:^(
                                              FBRequestConnection *connection,
                                              id result,
                                              NSError *error
                                              ) {
                              /* handle the result */

                              if (error) {
                                  NSLog(@"%@",error);
                              }
                              else
                                  NSLog(@"Result = %@",result);

                          }];
}

and it is log I received

Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x8d21ef0 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ParsedJSONResponseKey={
    body =     {
        error =         {
            code = 100;
            message = "(#100) The parameter object is required";
            type = OAuthException;
        };
    };
    code = 400;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x8e2ebd0, state: FBSessionStateOpenTokenExtended, loginHandler: 0x8e31d40, appID: 605088866273612, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x8e33240>, expirationDate: 2014-09-22 13:31:23 +0000, refreshDate: 2014-07-25 11:24:16 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
    installed,
    "public_profile",
    email,
    "publish_actions",
    "user_friends"
)>}`

I am not able to figure out what went wrong. Please help...

Sauvik Dolui
  • 5,520
  • 3
  • 34
  • 44

1 Answers1

0

You should correct this line :

  [FBRequestConnection startWithGraphPath:@"/me/objects/" 

to

  [FBRequestConnection startWithGraphPath:@"/me/objects/app_namespace:Object_name" 
Abkarino
  • 1,426
  • 1
  • 12
  • 19