Dhaval Panchal
Dhaval Panchal

Reputation: 2529

Add as Facebook friend on click iPhone

In my app I need to implement +add as friend type button to send Facebook friend requests. And if the user is not logged in then the login dialog should appear. I searched in Google and also in Stack Overflow and one or two questions for iOS add as friend button but with no answer, so I could not get anything working.

Upvotes: 2

Views: 1430

Answers (1)

dwarfy
dwarfy

Reputation: 3076

It's as simple as having a link like this:

<a target="_blank" href="http://www.facebook.com/dialog/friends/?id=FACEBOOK_PROFILE_ID&app_id=FACEBOOK_APP_ID&redirect_uri=SOME_URL"> ADD AS FRIEND </a>

So the URL to use is:

http://www.facebook.com/dialog/friends/?id=FACEBOOK_PROFILE_ID&app_id=FACEBOOK_APP_ID&redirect_uri=SOME_URL

And you have to replace FACEBOOK_PROFILE_ID, FACEBOOK_APP_ID, and SOME_URL by the real values.

On the iPhone, I would open a UIWebView pointing to this URL.

Upvotes: 1

Related Questions