How to implement an ios app with facebook leaderboard? - ios

I have a simple iOS app, which contain a score system.
I want to upload the score to Facebook leaderboard and compare with friends.
How can I do it?
I have no experience in this category.
So please help me.
More detail:
I have completed a simple ios game, which would save the best score got by player.
I want to create a leaderboard of the score on facebook,like game center.
so the score can be upload to the leaderboard shown on facebook.

Have a look here https://developers.facebook.com/docs/games/mobile/ios-tutorial/#opengraph for an introduction of the integration of iOS games and Facebook, and here https://developers.facebook.com/docs/games/scores for the explanation how to use the OpenGraph Scores API.
There is also an Achievements API which yoou could use: https://developers.facebook.com/docs/games/achievements/
As far as I know, results can only be queried for the User who gave the Access Token, respectively the User's friends. So, an overall leaderboard cannot be generated via these mechanisms.
Additional helpful links:
https://developers.facebook.com/docs/games/mobile/bestpractice
https://developers.facebook.com/docs/games/opengraph/
https://developers.facebook.com/docs/graph-api/reference/app/#scores

Related

How do I add GameCenter to my app?

I need to save the high score to the user's GameCenter and also let the user compare his/her high score with others's using the leaderboard. How do I put this into my app - AppDelegate?
Official guides, tutorials and videos.
https://developer.apple.com/game-center/
Other good tutorials
http://code.tutsplus.com/tutorials/ios-sdk-game-center-achievements-and-leaderboards-part-1--mobile-5701
http://www.raywenderlich.com/3276/game-center-tutorial-for-ios-how-to-make-a-simple-multiplayer-game-part-12

Facebook iOs Leaderboards

I would like to use the Facebook Scores API to make a social leaderboard for my iOS game.
From the documentation, I saw that it would require to request a publish permission so that I could post scores. The thing is that I don't want to publish to the player's wall (I simply think it's invasive), I just want to use the API backend to store the score, but everything I saw involved posting to the user's wall in order to write the score on the backend.
How should I proceed to only write the score without posting it into facebook?
If this thing exists, can I avoid requiring the publish permission?
Thanks
If you simply use the Score API as intended, the user will have the option of choosing whether to give your app the visibility permissions like "private, friends, public, etc". That lets the user decide what is invasive rather than you deciding for them.
Here is a related stackoverflow question with the opposite question, showing how users have control over what is shared with the API:
Facebook scores blocked by "only me" visibility

Facebook game Scores iOS

I'm making a new game right now where you can save your highscore, but I wobdered if I could implement a Facebook leaderboard. So the user could see their friend and see what their highscores are. Is this possible? Well, I saw this in different apps like Subway surfers from kiloo and 2048 from ketchapp. I didn't code anything because I don't how to do it. And I searched the facebook developer page and they said you have to do it with the graph API with scores or something. However, Hope you guys can help me out.
Best Regards.
Tom de Ruiter
There's the Facebook Scores API, the documentation is at this link
https://developers.facebook.com/docs/games/scores/
The downside is that Facebook will only store 1 score for a player, when you update it, you won't be able to see any previous scores (Of course, unless you set your own servers to do the job).
Also, there's no easy recipe to work with the Graph API, you just have to follow a few tutorials and you'll be in good shape to work with scores.

Is it possible to use the Scores & Achievements API from Facebook solely from a native mobile application?

I'm toying around with the Facebook APIs for a game I'm developing as a hobby project, after reading through the facebook SDK documentation, I'm still a little unclear as to what is required for developing games on the platform.
This is what I have :
Native iOS application
All game data is stored locally (levels, characters, items)
I don't have any backend servers, the game is completely client side
only.
I want to make the game "social" by adding achievements/friends lists, the facebook API seems like a good candidate for doing so
This is what I'm trying to achieve :
SSO - Hoping to make use of the facebook SSO for accounts so I don't
have to implement my own authentication etc. This saves time in not having to develop it myself.
Scores - when a particular event happens in my game it will award
some points to the user, I'm looking to use the scores API for
this.
Achievements - after the user has earned a certain amount of points,
or another predefined event has occurred, an achievement will be
granted, using the achievements API.
Question : Can I use the scores and achievements APIs from facebook without having my game deployed onto a backend server?
No, two reasons:
You need a URL to host the metadata for your achievements
The scores and achievements need to be posted using the App Access Token, and distributing that in your client app would allow anyone decompiling the app to change any of your app's settings, make posts on behalf of any of the app's users, redirect your traffic to another site, etc.
At the least, you need static pages describing the achievements, and a callback script you can hit from your mobile app which triggers the publishing to Facebook of the Scores and Achievements
Update 2012-09-06: it's no longer necessary to use the app access token to post scores and achievements, so you could use scores in a mobile app, but you still need a website to hold the achievement metadata
I found a good answer for this recently.
There's no point in duplicating, so please see the answer here:
Using Facebook Achievement API in Android
(It is relevant for iOS as well as any other platform)

iOS Facebook SDK highscore story is not being displayed on user's timeline

I'm developing an iOS game and I want to post highscore stories into user's Facebook timeline.
I'm issuing a POST request to the scores api passing app access token and also the score. The method return true which, as stated in developers documentation, means that the score has been posted successfully.
The problem is that even that method seems to be working right, the highscore story never gets displayed on user's timeline. I'm aware that not all stories will be posted, but there wasn't even a single one I was able to see there. So it is not working.
The app is setup as a native iOS app under Games category.
Is there anything else I need to setup on app settings to get this working?
Thanks in advance.

Resources