这段代码没有在朋友的最后生成通知。但是发送成功没有产生错误。我正在为朋友建立一个游戏网址的应用程序邀请他们玩。我写了下面的代码发送url.it的工作正常而不是没有产生错误,但用户没有收到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
检查它找不到通知的原因。
答案 0 :(得分:2)
我在之前回答的S / O问题上找到了我对这个问题的答案。基本上,您需要在Facebook App设置中设置App Store Id和Bundle Id,以便发送邀请。您可以找到该信息:here
答案 1 :(得分:0)
只有当您的应用是游戏时,您的应用发送的通知才会在移动设备上收到。如果您的应用不是游戏,通知仍会传送到桌面上的App Center。