My iOS app allows people to log in using Facebook, and automatically checks to see which of your friends are currently registered as using the app. All of your friends who are not currently using the app are in an “invite” list, in much the same way that DrawSomething has a ‘play’ and an ‘invite’ list of friends.
Regardless of whether you invite or play, a challenge is stored in the database ready for whenever your friend logs in.
Where I’m stuck is trying to work out how I would allow a user to post onto their friends wall. My php code already works out whether or not they are registered so from there I would simply need to post to ‘Friend B’s wall. I haven’t been doing php for particularly long, and I’ve found that the Facebook code I’ve dealt with elsewhere isn’t as self-explanatory as other sdk’s etc.
I’m not really sure where to begin, as all of the Facebook “information gathering” i.e. friends user id is done in the app itself. I can pass this to the php code easily enough, but then I’m not sure how to use that to post onto their wall. I would assume that since the server is not logged into User A’s Facebook account that it would need to do this somehow before it is allowed to post to their friend’s wall, but I don’t want the user to have to log in again in order to do this. Given that DrawSomething allows you to invite via Facebook I know it’s possible, but I have no idea how to do it.
To sum up:
It’s an iOS app, and I want users to be able to invite their friends by posting onto the friends Facebook wall.
If anyone can point me in the right direction I’d be extremely grateful.
OK so after battling with this for some time and looking high and low without any luck, I managed to stumble across how to do this today.
I’ll update it here so anyone else who is struggling can see:
}
And that’s it!
I put this into my AppDelegate class, and call it when I hit my invite button – job done!
One thing to note is that this does result in a pop-up dialog which allows the user to add their own message, which personally I think is a good thing.