Possible Duplicate:
Like button in iOS application
I'm trying to make it easier for a user of my App to 'Like' my facebook application.
The scenario i开发者_如何学Pythons, the user has already logged in and authorised my application, so I have the user's oauth token. Since the Graph API does not allow this, I've tried multiple other ways, all unsuccessfully.
Methods: 1) Have it navigate to the facebook application's facebook page in a UIWebView 2) Make my App launch the Facebook App unto my facebook application's page.
In method 1, the main issue is the user will in many cases have to login in the webview again, because I've not found a way to somehow pass the token to the webview session. In the Foursquare api for example, all you need to do is to append the token to the url as a query string, (http://foursquare.com/blabla?access_token=52521....), this doesnt work in facebook.
In method 2, which can be accomplished using this method:
NSString *fbAppUrl = [NSString stringWithFormat:@"fb://applications/%@",[App facebookAppId]];
BOOL didOpenOtherApp = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:fbAppUrl]];No matter what I try, i.e. fb://applications/%@ or fb://pages/%@ or fb://profile/%@ or fb://feed/%@, the facebook app just opens to a blank page.
Any hints or tips from anyone?
I would love to be able to make use of method 2 and fall back to method 1 if the facebook app is not installed, but in essence, method 1 will result in a very low conversion rate, so hoping to avoid it.
Facebook iPhone app doesn't currently support that, nor does the graph api. The only way supported by Facebook to "like" a url is from their iFrame code. There is a halfway decent blog post on how to do a variation of option #1 but looks to see if they are logged into Facebook via Safari. Not the best user experience, but all that Facebook allows at the moment.
It seems there is an agreement on not being able to do this. However, this post shows you can: Using 'Like' with the Facebook Graph API on iOS
To back it up, here's an excerpt from FB Graph API documentation:
You can comment on or like any object that has a /comments or /likes connection by posting to https://graph.facebook.com/OBJECT_ID/comments and https://graph.facebook.com/OBJECT_ID/likes, respectively:
(source: http://developers.facebook.com/docs/reference/api/)
精彩评论