Facebook iOS SDK - sending a user request for an application on facebook

I am trying to send an application request via facebook using the iOS SDK for facebook, im using the following code:

NSString *message = [[NSString alloc] initWithFormat:@"blah blah blah"]; NSString *data = [[NSString alloc] initWithFormat:@"blah blah blah"]; NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:message, @"message", data, @"data", nil]; [_facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/apprequests",userID] andParams:params andHttpMethod:@"POST" andDelegate:self]; [message release]; [data release]; 

This gives me the following error:

 Error: Error Domain=facebookErrDomain Code=10000 "The operation couldn't be completed. (facebookErrDomain error 10000.)" UserInfo=0x788c5b0 {error=<CFBasicHash 0x788c080 [0x1bf53e0]>{type = mutable dict, count = 2, entries => 2 : <CFString 0x788b560 [0x1bf53e0]>{contents = "type"} = <CFString 0x788c3f0 [0x1bf53e0]>{contents = "OAuthException"} 3 : <CFString 0x788c560 [0x1bf53e0]>{contents = "message"} = <CFString 0x788c480 [0x1bf53e0]>{contents = "(#200) Invalid Request: There was a problem with the parameters of the request. Body of an error/warning message. Title is: Invalid Request"} } 

So did anyone succeed with this, or do you know a way to send a request to a facebook user using the iOS SDK for facebook?

thanks

+4
source share
5 answers

You can easily send an application request very easily using the Facebook SDK

To apply for the application Make sure the following steps

1) Make sure you add the latest Facebook file to your application folder

If not, you can download from this link.

Now you just need to add the FBConnect folder to the project folder.

2) Then, make sure you register your iphone application as a “Facebook application”. your application integrates with Facebook in the "Basic Application Settings" section.

If not, you can do it here .

 NSString * friendId=@ "FacebookId Of Your Friends"; NSLog(@"%@",friendId); NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Hi please add me as a friend.", @"message", friendId, @"to", nil]; [appDelegate.facebook dialog:@"apprequests" andParams:params andDelegate:self]; 

Please remember to accept the FBdialogDelegate protocol first in the ViewController class.

+8
source

It is not possible to send an application request without a dialogue using only the POST method.

In accordance with the documents :

This SDK provides a method for popping up a Facebook dialog box. Currently supported dialogs are the login and permissions dialogs used in the authorization stream and the dialog box for posting messages to the user feed.

Thus, you cannot send an application request through standard dialogs. It works only for web applications.

+1
source

andyc, using this method, you can send an application request only. And please make sure you register your app as an “App On Facbook”. The problem is that in order for the notification to appear on the desktop website, your Facebook application must have a Canvas URL. The URL does not even have to be valid, it just needs to be defined in the application settings. I checked with a test application that this really solves the problem. This is intentionally done by Facebook because when a user clicks on a notification, they are sent to your Canvas URL on the desktop website.

I did the same and I get the application request in my notifications. you still have problems sending your application request, then look at the link below

"apprequests" dialogue reports success, recipients receive nothing

+1
source

I was able to send the request using Ruby through the standard POST in / me / apprequests. I provided a valid access_token for the application and a message parameter. The iOS SDK may not have a dialog box yet.

NOTE. the user must install the application once before you can send them notifications and invitations. So, Andrey is right. There is no way to send an application request to invite someone to join the new application yet.

0
source

Try this code,

 NSDictionary *params = @{@"to":text}; NSString *message = @"MESSAGE"; NSString *title = @"TITLE"; [FBWebDialogs presentRequestsDialogModallyWithSession:nil message:message title:title parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { if (error) { UIAlertView *Alert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Request not sent" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil]; [Alert show]; } else { if (result == FBWebDialogResultDialogNotCompleted) { // Case B: User clicked the "x" icon UIAlertView *Alert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Canceled request" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil]; [Alert show]; NSLog(@"User canceled request."); } else { UIAlertView *Alert = [[UIAlertView alloc]initWithTitle:@"Success" message:@"Request sent successfully" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil]; [Alert show]; NSLog(@"Request Sent. %@", params); } } }]; 
0
source

All Articles