I’m using this to send a request to a friend on Facebook. I’d like for the person that received the request to be able to open it and receive a bonus for accepting the request. How would I go about acknowledging the request on the receiving end?
-(IBAction)sendRequest:(id)sender
{
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Come check out my app.", #"message",
nil];
AppDelegate *aDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[aDelegate.facebook dialog:#"apprequests" andParams:params andDelegate:self]
}
You should check the Android and iOS: Discovery via Requests Best Practices official blog post.
It discusses (among other things) how to send user requests along with some relevant data, and then how to identify the request and get the associated data.
Related
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.
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.
I want to implement facebook like button in my native iphone app. So that user can like my facebook page . I am already sharing facebook status updates, but am unable to implement like button.
I was unable to find any helpful resource on web.Please help.
Aaaand here's one I prepared earlier (using FBConnect, the FB api):
If you have the id of the post as postId
NSString *graphPath = [[NSString alloc]
initWithFormat:#"%#/likes",
postId];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
[[delegate facebook] requestWithGraphPath:graphPath andParams:params andHttpMethod:#"POST" andDelegate:self];
of course you'd need to change how you got the Facebook singleton (I used [delegate Facebook]).
How to send direct message by dialog to friend on Facebook iPhone sdk ? I have been tried this code but not properly working?
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"I'm using the MyFBTest App", #"name",#"http://listentowebby.com/wp-content/themes/cw/images/facebook.png", #"link",nil];
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[[delegate facebook] dialog:#"send"
andParams:params
andDelegate:self];
you can't send direct message in mobile devices says facebook documentation send dialog
and the method you are using will only send the request, and if the user to whom sending request, has installed the app, then it will able to read the message else not.
one other way to convey your message is to post on friends wall, for which you may refer to this thread facebook ios post on friend's wall
I am trying to use the facebook dialog to send request to my friend using the following:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Come check out my app.", #"message",
nil];
[facebook dialog:#"apprequests"
andParams:params
andDelegate:self];
the delegate - (void)dialogDidComplete:(FBDialog *)dialog { was triggered but apparently I dont see anything on my friends account. I've added him as a tester of the app through the developer account. Why is this?
From https://developers.facebook.com/docs/requests/:
User to User Requests are only available for Canvas apps, not
websites, as accepting a request will direct the user to the Canvas
Page URL of the app that sent the Request.
Do you have a canvas url specified in your app settings?
Also what does the response look like from Facebook at the completion of the dialog? It should look like:
{
request: 'REQUEST_OBJECT_ID'
to:[array of USER_IDs]
}