Publish message to friend's wall from iPhone app - iphone

I would like my iPhone app to be able to post a static message to a user's friend's facebook wall. Something like it shows the static message up above, and then a place to type in friends name and shows suggested friends. Is this done through graph api, or is there a key of permissions that the POST method can use?

Looks like this might be what you are after.
From the link:
"You just have to send your friend's Facebook ID as a parameter under the key "target_id".
set a parameter under the key #"target_id" on the parameters dictionary (when invoking dialog:andParams:andDelegate: on the Facebook object).
Here you have a sample post using the new sdk (the one that uses graph api):
NSMutableDictionary* params = [NSMutableDictionary dictionary];
[params setObject:#"Some text" forKey:#"user_message_prompt"];
[params setObject:#"another text" forKey:#"action_links"];
[params setObject:#"Yet another text" forKey:#"attachment"];
[params setObject:#"SOME FACEBOOK ID" forKey:#"target_id"];
//At some point you need to create the following Facebook instance
[facebook dialog: #"stream.publish"
andParams: params
andDelegate: self];

you first need to request the friend list and then provide an interface in your app where user could select which friend's wall he want to write on... :)
afterwards, you can pass the selected friends id to the dialog you are presenting to the user... Atleast I am used to do it this way and it seems to be a pretty standard way of publishing something on user's wall...
hope it helps

Related

graph api retrieves list of users name where name is like given text in ios

I am currently developing one application. In my application i have added facebook graph api for using facebook functionality.
Its working perfectly and i can able to post message on my wall, i want add another one functionality. user can able to search user they may know or don't know. so i have one text field, if user enter any name in that filed, i want to retrive facebook users list that they have name like user entered name.
If you logged in facebook and type any name or place in "People search by name,place", then we will get list of users (you may know and don't know).
I want to implement this functionality in my application. I am using graph API. is it possible to retrive users list ?
Please any one guide me.
I used
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:2];
[variables setObject:#"priya" forKey:#"q"];
[variables setObject:#"user" forKey:#"type"];
// [variables setObject:#"post" forKey:#"type"];
FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:#"search" withGetVars:variables];
NSLog(#"Raw HTML: %#", fb_graph_response.htmlResponse);
i got result but it only shows 25 results? any idea
Hi Friend i solved my problem.i used this coding to get next 25 result.
FbGraphResponse *next_page_fb_graph_response = [fbGraph doGraphGetWithUrlString:next_page_url];
And i have another one issue. if i searched in facebook i got all user name which are not allowed public search.
But in fb graph api i tried to get users name it is not showing which are not allowed public search.
any one resolve this issue?

How to limit facebook apprequests to certain users?

I have a iOS mobile application that needs to send out an app request to a user's friends. From here:https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk and here:https://developers.facebook.com/docs/reference/dialogs/requests/#mfs it appears I am able to suggest the users that this app requesst gets sent to. I am making the call like this:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Check out this awesome app", #"message",
#"1xxx4,10xxxx0,", #"suggestions",
nil];
[self.facebook dialog:#"apprequests"
andParams:params
andDelegate:nil];
However, once the multi-friend request dialog is presented, I am still able to type in a friends name, even if it was not part of the "suggestions". How do I make this restriction?
The end goal is to restrict that list to facebook friends who are not users of this app. The docs also mention a "filters" parameter, but i have not got that to work.
Ideas?

Post to facebook and unlock levels

I'm programming my own iPhone game and since I don't want the users to pay for my levels, I'd like to allow them to post something on their FB or twitter timeline. Once it's done, I'd like to unlock the level for free, and do that for each levels pack.
Anyone has an idea on how to do this ? I know I can use Facebook API for iOS to post a status, but how can I ensure the action has been done ?
Each post or tweet has a confirmation delegate method. Add an NSNotification to unlock your level on confirmation completion.
You can do this, it's easy using graph api for FB.
You can say user to post message hardcoded in you code and you receive response from api that message is posted on his wall then you can unlock the level.
Also if you want that user can't edit message then you need to post message in background and it easy like below code.
NSMutableDictionary *dictPara = [[NSMutableDictionary alloc] init];
[dictPara setObject:objSelGameStep.smsg forKey:#"message"];
[dictPara setObject:#"status" forKey:#"type"];
[facebook requestWithGraphPath:#"me/feed" andParams:dictPara andHttpMethod:#"POST" andDelegate:self];
i hope this may help you.

How do I like a Facebook AppID through IPhone Application?

I am developing a iPhone application in which I want to simply 'Like' my own Facebook AppID.
For Facebook integration I am using FBConnect and Graph API (https://github.com/facebook/facebook-ios-sdk/blob/master/README.mdown).
After researching, I found that I was supposed to use the following method, which I attempted to implement in the "DemoAppViewController.m" of the sample code when the 'publishStream' button was selected:
NSMutableDictionary *params = [NSMutableDictionary dictionary]; //Use an empty dictionary
[_facebook requestWithGraphPath:#"https://graph.facebook.com/163221793740496/likes"
andParams:(NSMutableDictionary *)params
andHttpMethod:#"POST"
andDelegate:(id <FBRequestDelegate>)self];
However, my FBRequest.m 'responseString' indicates: {"error":{"type":"GraphMethodException","message":"Unsupported post request."}}
What am I doing wrong and how can I make this work?
From what I understand, all I need to do is attach my accessToken to https://graph.facebook.com/163221793740496/likes. What exactly does that mean, and how is it accomplished?
Thanks in advance!
P.S. - In case there was any confusion, my post was in reference to having a user sign into Facebook with their account login via a fb like button in the application. After the user allowed the appropriate permissions, my app would 'like' the AppID with the user's account.
You can't programmatically like a page on Facebook. It would be enthusiastically abused.

what is target id in this code

what is target id is it application id or what. what should be its data type.
NSString *message = #"test message here";
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setObject:message forKey:#"message"];
[params setObject:toID forKey:#"target_id"];
[[FBRequest requestWithDelegate:self] call:#"facebook.Stream.publish" params:params];
please answer soon....
Read the beginning of this post.
Its a key in params. from the looks of things (not for sure, since you provide basically no code or context of the code) it is a string that contains the ID to which you are sending your facebook request. Try looking in the API for the Library you are using.
Documented here: http://developers.facebook.com/docs/reference/rest/stream.publish
The ID of the user, Page, group, or
event where you are publishing the
content. If you specify a target_id,
the post appears on the Wall of the
target profile, Page, group, or event,
not on the Wall of the user who
published the post. This mimics the
action of posting on a friend's Wall
on Facebook itself.