LetzFlow
LetzFlow

Reputation: 481

Facebook iOS SDK 3.1 Using Scores (Game API)

I'm trying to implement the new Facebook API 3.1 in my iOS Game and I managed to get the basic features like login working, but now I'm struggling with the game features. I would like to post the scores from my game, but the tutorial on the developer page only shows it for the old deprecated API. Since this was part of the Graph API I guess it should work with the new SDK as well, but I just cannot figure out how.

So what I would need is: 1. How to post scores 2. How to get my own score and the scores of my friends who play the game as well

Any ideas on that?

Upvotes: 2

Views: 2589

Answers (1)

C Abernathy
C Abernathy

Reputation: 5523

You can use code similar to, posting a score of 100:

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                          @"100", @"score",
                          nil];

[FBRequestConnection startWithGraphPath:@"me/scores" 
                             parameters:params 
                             HTTPMethod:@"POST" 
                      completionHandler:
     ^(FBRequestConnection *connection, id result, NSError *error) {
         // Handle results
     }];

For a recent example using the new methods, see: https://developers.facebook.com/docs/tutorials/ios-sdk-games/open-graph/

Upvotes: 5

Related Questions