6

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 is, 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.

Community
  • 1
  • 1
Skela
  • 884
  • 10
  • 18
  • Just in case anyone comes across this whilst searching for a solution. Facebook has just released support for native mobile like functionality. https://developers.facebook.com/blog/post/2012/06/20/bringing-like-to-mobile/ – Skela Jun 26 '12 at 15:04

2 Answers2

4

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.

bkaid
  • 51,465
  • 22
  • 112
  • 128
  • Thx bkaid, yeah this is in principle the same as my method 1. I'm still looking for a way around it, surely there must be a way? – Skela May 23 '11 at 10:06
  • Not officially at the moment. It would be too easy for scammers to abuse otherwise. I'll update the answer if they add an option. The only other way would be to store the user's login information and do an http post to the url that the facebook.com website uses but that is obviously scraping and a violation of their terms of service. – bkaid May 23 '11 at 15:07
  • Anyways, cheers for that, I'll update this answer too if I come across anything, but I'm sure you will do that before me ;D – Skela May 23 '11 at 15:28
0

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/)

Community
  • 1
  • 1
Oded Ben Dov
  • 9,936
  • 6
  • 38
  • 53
  • terribly sorry, this post explains that you can like pretty much everything, except for pages on facebook: http://stackoverflow.com/questions/5837010/facebook-api-liking-page-on-behalf-of-user-extended-permissions – Oded Ben Dov Dec 02 '11 at 07:05
  • 1
    Be careful when posting copy and paste boilerplate/verbatim answers to multiple questions, these tend to be flagged as "spammy" by the community. If you're doing this then it usually means the questions are duplicates so flag them as such instead. – Kev Dec 02 '11 at 11:16