Im trying to send an app request through facebook using the facebook iOS SDK, im using the following code:
NSString *message = [[NSString alloc] initWithFormat:@
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);
}
}
}];