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

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)

Related

Where to save Game Scores, Last Level Passed, etc.? Parse(Cloud backend) or Facebook?

noob to iOS and Game Dev
I am writing a simple game which has incremental levels (flow chart below). Only thing that I want to do it save information like "Last level passed" on to the cloud.
I would like it so that whether the user signs in to my app from iOS, Android, Web (I'm starting off with iOS app only) - always goes back to the right level.
My fundamental architecture question - should I saving this information in somewhere on Facebook API/SDK or in my own Cloud Backend? (I'm using Parse as my backend)
I would save it into Parse so that you are not tied to Facebook for your users. I know many people do not want to connect their Facebook accounts to apps, etc. so this way you can have one solution for everyone.
Also, by using your own backend you can use Facebook a way for users to log in and then later allow them to log in via twitter, etc. and your game would still work as it should regardless of how the user chose to create an account.

How to fetch Facebook user's full friend list in Facebook iOS SDK

I had a question concerning the Facebook iOS SDK that has been troubling me ever since i started my iOS project so I thought I could post it here to see if any of you had wisdom to share on this matter.
For my Facebook connected app to function properly I need to have access to the Facebook user's complete friend list along with their names, ids and profile pictures. After some intensive research I was surprised to learn that in version 2.0 of the Graph API Facebook has made it so that you can only retrieve a friend list of your friends who are currently using the app and have approved the app. This kind of data doesn't really work for my app as the main point is that you are met by your friend list as opposed to an empty list with only a few people who have approved the app.
My question is if there is any possible way for me to have access to the user's full friend list and display it in a table view with their profile picture without every single one of them having to approve the app. I don't mind if it is a complicated solution. The reason I ask this is because i have seen several apps that can fetch full friends lists such as:
http://www.connect.com
and
http://www.birthdayboardapp.com
and they must have found a way to do it as the way Connect displays the user's friend list is exactly the way I would like to do it i.e. in an iOS contacts app style way.
I would be grateful for any guidance or solutions,
Thanks Again!
P.S. Here are some questions I have previously looked at but do not suggest possible workarounds
Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app
Get ALL User Friends Using Facebook Graph API - Android
There are no workarounds, if it works in some other App then it just means that they are still using a Facebook App created before end of April 2014. They will stop getting the full friendlist after April 2015, when v1.0 Apps will get upgraded.
There are ways to get the whole friendlist like invitable_friends and taggable_friends, but those endpoints are supposed to get used for very specific tasks (for inviting in games and for tagging).

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

iOS 6 - How to post tweet from a twitter account that is not on the user's device

I'm in the very early planning stages of building another iOS app. I'm hoping to be able to post tweets to my own account when users take specific actions from within an iOS 6 app. That is, I want to authenticate to twitter as a user that is not stored on the user's device. Is it possible to use the Social and Accounts frameworks to accomplish this, or should I be investigating another framework? If someone could point me in the right direction, I'd really appreciate it.
cheers,
a

Registering and posting Facebook achievements from an iOS app

I have an existing iOS app on the App Store that includes Game Center achievements. Since it also has a working Facebook Connect implementation, I'd like to leverage the social channels available through the new Achievements Graph APIs with my apps.
I have created the corresponding achievement pages ready to be registered with Facebook as achievements for my app. From what I have read, since the app auth token has to be used to submit achievements and scores, I'm doing all of this on my server using some PHP scripts so I don't have to ship my secret key with my app binaries. I'm planning to have my iOS app call a script on my server when submitting achievements or scores.
I am using the same FB app that I use for the native iOS app. Obviously I want it to start generating stories and timeline events when the user unlocks achievements or reaches a new high score.
However I am running into a big stumbling block when trying to register the achievements for the FB app. I get the following error with the script that does the registration :
OAuthException: (#15) This method is not supported for native apps
I seem to be doing everything right, sending a POST to the /<appid>/achievements API with the URL for the achievements, etc.
In an effort to work around limitations on these API by Facebook, I have also enabled the existing mobile app to also be a "Website" and "App on Facebook" in the developer settings. To no avail.
So my question is... am I missing something to enable achievements that could be submitted from an iOS app through an intermediary server? I don't mind setting up canvas pages and so on if necessary, but I'd rather not have the users re-authenticate as a wholly separate app just so they can post achievements and scores to their Facebook stream.
What I'm trying to achieve is at most ask the user for additional permissions on the existing app on their devices, if necessary. It should be possible to invoke a script on my server that will push the achievements to Facebook when needed - but how ?
Is the only way to do this to use a separate FB app that is not set as a native mobile app at all, or can it be a combination native/Web app?
It means you've probably configured your application on Facebook's side as 'Native/Desktop' instead of 'web'.
In this configuration your app secret is untrusted because it's assumed you've shipped it with the client code - there's no reason your IOS app won't work in 'web' mode, so use that instead
(I'm assuming you haven't actually shipped your app secret in client code - if you have, it's a huge security problem unless your app is set to 'Native/Desktop')

Resources