how send friend request to a person in Facebook through iPhone app? - iphone

Is there any way to send friend request through iPhone application? if yes, please help me. I've searched in web but I didn't get solution.
I got the following code to send app request not to send friend request
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];
[variables setObject:[NSString stringWithFormat:#"Come and join XYZ App."] forKey:#"message"];
[variables setObject:#"url" forKey:#"picture"];
[variables setObject:#"Hello" forKey:#"name"];
[variables setObject:#"Description" forKey:#"description"];
[_facebook requestWithGraphPath:[NSString stringWithFormat:#"/%#/feed",facebook_user_id]
andParams:variables
andHttpMethod:#"POST"
andDelegate:self];
Please help me.

There is no API to send friend requests, this must be done using one of Facebook's interfaces

The Facebook Graph API doesn't support adding friends. You can get list of friends from the Facebook profile but you can not send the friend request from Facebook Graph API.

Related

Does the facebook uri scheme no longer work on iOS6?

I used fb://publish/?text= to publish from my app in iOS to Facebook but this doesn't work anymore with the Facebook app update to version 5.0 (not iOS6 update). Does anyone know how to publish with new app? Are there another URI schemes that can be used?
I don't want to use any native integration, just a link...
Try this code this will be helpful to you.
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setObject:str forKey:#"message"];
[facebook requestWithMethodName:#"stream.publish" andParams:params andHttpMethod:#"POST" andDelegate:self];
But for this you must have assigned publish permission.

FaceBook app request is shown on website only, but not on FB app

I'm sending an app request from my iphone app, using this code:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Join my app", #"message", [NSString stringWithFormat:#"%#", [[filteredContacts objectAtIndex:path] valueForKey:#"id"]] ,#"to",
nil];
[facebook dialog:#"apprequests"
andParams:params
andDelegate:self];
while [[filteredContacts objectAtIndex:path] valueForKey:#"id"] returns a facebook ID value.
When a FB friend of mine gets the request he can see it in the notifications section on his facebook - but only on the website itself.
When trying to find it in the facebook iphone app - it's just not there. also, it's not found on the mobile site.
How can it be posible that I see the notification on the website only?
Well the answer was very simple -
I should have define the app as a mobile app when I created it as a FB app.

How to send add friend request (to facebook user) from iOS application?

I know there are lot of questions on this topic but none of those have satisfactory answers. Again I am not so confident about help as 2 of my last 3 questions are unanswered. Well Still, ma question is, Is there any way we can send friend request to any facebook user from one iOS application? Of course we have user id of that user.
As I have googled much and went through many links including
how send friend request to a person in Facebook through iPhone app?
Can a facebook friend request be sent from my own app?
https://developers.facebook.com/docs/reference/dialogs/requests/
etc..
And finally I found it:
http://www.facebook.com/dialog/friends?id=100002487216939&app_id=123050457758183&redirect_uri=http://www.example.com/response/
This dialog do the same what I want. So is there any equivalent for this in graph. Or something in iOS sdk, FBDialogueDelegate. Any thing that can help me out.
For user-to-user requests, you can do this (using ARC):
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys: message, #"message", title, #"title", nil];
[[self facebook] dialog: #"apprequests"
andParams: [params mutableCopy]
andDelegate: delegate];
For app-to-user requests, you can do this:
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys: message, #"message", nil];
[[self facebook] requestWithGraphPath: #"[FRIEND ID]/apprequests"
andParams: [params mutableCopy]
andHttpMethod: #"POST"
andDelegate: delegate];
Make sure you have the right access tokens and the correct Facebook configuration (canvas page setup etc.) for each.

How to post on user's wall indicating an app was installed?

http://developers.facebook.com/docs/reference/api/post/ doesn't seem to give a clue about it. Would "Install(ed)" be an action? If the feed is something like " installed on iPhone", how to make the to be a link such that the user can tap on it so to lead the user to App Store?
I know the API to use, something like the following. But I just don't know what are the params that should be there for the above feed.
NSMutableDictionary* params = [[NSMutableDictionary alloc] initWithCapacity:1]
[params setObject:username forKey:#"name"];
[params setObject:#"Description" forKey:#"description"];
[facebook requestWithGraphPath:#"me/feed"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
You can get all info of setting the facebook ios sdk with a screenshot of a post..
http://developers.facebook.com/docs/mobile/ios/build

i want to share friend's post via graph api

I want to share some posts in facebook via graph api.
But there's no api like this. only "feed" exists.
I tried to use "me/feed" graph api action to share my friend's post(and post in page). but it's not same as i shared in facebook website. i want to know how.
source is..
NSMutableDictionary *fbArguments = [[NSMutableDictionary alloc] init];
NSString *linkURL = #"http://media.daum.net/society/others/view.html?cateid=1067&newsid=20120106140112792&p=munhwa&RIGHT_COMM=R4";
[fbArguments setObject:linkURL forKey:#"link"];
[facebook requestWithGraphPath:#"me/feed"
andParams:fbArguments
andHttpMethod:#"POST"
andDelegate:self];
[fbArguments release];
And I noticed there's no action for sharing friend's post(or photo), page's post via facebook iphone app. (so weird. don't you need this action?)
what can i do? can you help me?
Thanks.
i'v succeeded sharing photo. that is 'Link'.
source is
NSMutableDictionary *fbArguments = [[NSMutableDictionary alloc] init];
NSString *linkURL = #"https://www.facebook.com/photo.php?fbid=324225380935287&set=a.265279620163197.68309.194442110580282&type=1";
[fbArguments setObject:linkURL forKey:#"link"];
[fbArguments setObject:#"good!" forKey:#"message"];
[facebook requestWithGraphPath:#"me/feed"
andParams:fbArguments
andHttpMethod:#"POST"
andDelegate:self];
[fbArguments release];
i added message. and this is perfectly same as i shared via facebook web.
but there is one problem. this never makes back reference(trackback?).
if I share a photo via facebook web, I can see "5 shares" upper comment list, and my username is is there.
But this way, There is no my username. No trackback.
what can i do?
thanks.