此代码不会在朋友端生成通知。但是成功发送不会产生错误。我正在为朋友的游戏 url 构建一个应用程序以邀请他们玩。我已经编写了下面的代码来发送 url。它工作正常并且不会产生错误但用户没有收到任何对 App 的请求。
//Fbwebdialog generating no error
[FBWebDialogs presentRequestsDialogModallyWithSession:[FBSession activeSession]
message:[NSString stringWithFormat:@"I just smashed friends! Can you beat it?"]
title:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Case A: Error launching the dialog or sending request.
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 ;
NSLog(@"User canceled request.");
} else {
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"]);
NSArray *requestIDs=[params objectForKey:@"request"];
}
if ([recipientIDs count] > 0){
//[self showMessage:@"Sent request successfully."];
//NSLog(@"Recipient ID(s): %@", recipientIDs);
// punGameViewController *pun=[[punGameViewController alloc]initWithNibName:@"punGameViewController" bundle:nil];
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Successfully send" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alrt show];
// [self.navigationController pushViewController:pun animated:YES];
}
}
}
}];
//end of code here
检查它找到不生成通知的原因。