问题
I'm trying to send a facebook invite for my iOS application, but it never seems to get there and I can't figure out why. Here is the code I'm using:
-(void)inviteFriend:(NSString *)facebookId {
NSDictionary *parameters = @{ @"to": facebookId };
[FBWebDialogs
presentRequestsDialogModallyWithSession:nil
message:[NSString stringWithFormat:@"You've received an invite to my game!"]
title:nil
parameters:parameters
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
{
if(error)
{
NSLog(@"Some errorr: %@", [error description]);
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Invitiation Sending Failed" message:@"Unable to send inviation at this Moment, please make sure your are connected with internet" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alrt show];
}
else
{
if (![resultURL query])
{
return;
}
NSDictionary *params = [self parseURLParams:[resultURL query]];
NSMutableArray *recipientIDs = [[NSMutableArray alloc] init];
for (NSString *paramKey in params)
{
if ([paramKey hasPrefix:@"to["])
{
[recipientIDs addObject:[params objectForKey:paramKey]];
}
}
if ([params objectForKey:@"request"])
{
NSLog(@"Request ID: %@", [params objectForKey:@"request"]);
}
if ([recipientIDs count] > 0)
{
//[self showMessage:@"Sent request successfully."];
NSLog(@"Recipient ID(s): %@", recipientIDs);
//UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Invitation(s) sent successfuly!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
//[alrt show];
}
}
}friendCache:nil];
}
The console output appears like it is sending:
[FacebookManager inviteFriend:]_block_invoke [Line 288] Request ID: 766594713370919 [FacebookManager inviteFriend:]_block_invoke [Line 293] Recipient ID(s): ( correct User ID here )
but when I log in to that facebook user via my iOS device, there is no notification.
The question appears to be a duplicate of a couple others, but neither have answers: Facebook setting for Invite friend in Facebook Code for fb invitation not working
Thanks.
回答1:
Have set the iOS setting on Facebook app account ?
Note that the notification is only available at Mobile device only (NOT ON WEB BROWSER).
Facebook developer basic settings
来源:https://stackoverflow.com/questions/23659932/facebook-app-invite-not-received