我正在尝试为我的 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 邀请朋友:]_block_invoke [第 288 行] 请求 ID:766594713370919 [FacebookManager 邀请朋友:]_block_invoke [第 293 行] 收件人 ID:( 此处正确的用户 ID )
但是当我通过我的 iOS 设备登录到该 facebook 用户时,没有通知。
这个问题似乎与其他几个问题重复,但都没有答案: Facebook 邀请朋友的 Facebook 设置 Facebook 代码中的 Facebook 邀请不起作用
谢谢。