我正在尝试为我的iOS应用程序发送facebook邀请,但它似乎永远不会到达那里,我无法弄清楚原因。这是我正在使用的代码:
-(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];
}
控制台输出显示为发送:
[FacebookManager inviteFriend:] _ block_invoke [第288行]请求ID:766594713370919 [FacebookManager inviteFriend:] _ block_invoke [第293行]收件人ID :( 在此处更正用户ID )
但是当我通过iOS设备登录该Facebook用户时,没有任何通知。
这个问题似乎与其他几个人重复,但都没有答案: Facebook setting for Invite friend in Facebook Code for fb invitation not working
感谢。
答案 0 :(得分:0)