从facebook中的iOS应用程序邀请Facebook用户:邀请未被发送

概述我试图邀请Facebook用户尝试我的iOS应用程序(尚未在商店中,尚未完成). 我使用facebook API来验证用户,然后尝试使用以下代码: - (void)shareWithFriends:(id)sender{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" 我试图邀请Facebook用户尝试我的iOS应用程序(尚未在商店中,尚未完成).

我使用facebook API来验证用户,然后尝试使用以下代码:

- (voID)shareWithFrIEnds:(ID)sender{    UIAlertVIEw *alert = [[UIAlertVIEw alloc]                          initWithTitle:@"Invite FrIEnds"                          message:@"If you enjoy using this app,would you mind taking a moment to invite a few frIEnds that you think will also like it?"                          delegate:self                          cancelbuttonTitle:@"No Thanks"                          otherbuttonTitles:@"Tell FrIEnds!",nil];    [alert show];}- (voID)alertVIEw:(UIAlertVIEw *)alertVIEwdIDdismissWithbuttonIndex:(NSInteger)buttonIndex {    if (buttonIndex == 0) {        // User has clicked on the No Thanks button,do not ask again        NSLog(@"Chitty user says he doesn't wanna share");    } else if (buttonIndex == 1) {        // User has clicked on the Tell FrIEnds button        [self performSelector:@selector(sendRequest) withObject:nil afterDelay:0.5];    }}- (voID)sendRequest {    // display the requests dialog    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:nil];    [FBWebDialogs presentRequestsDialogModallyWithSession:nil                                                  message:[Nsstring stringWithFormat:@"Try this app,brah!"]                                                    Title:nil                                               parameters:params                                                  handler:^(FBWebDialogResult result,NSURL *resultURL,NSError *error) {                                                      if (error) {                                                          // Case A: Error launching the dialog or sending request.                                                          NSLog(@"Error sending request.");                                                      } else {                                                          if (result == FBWebDialogResultDialogNotCompleted) {                                                              // Case B: User clicked the "x" icon                                                              NSLog(@"User canceled request.");                                                          } else {                                                              NSLog(@"Request Sent.");                                                          }                                                      }}];}

但是,当我选择要向谁发送邀请的用户然后点击发送.什么都没发生.我收到“请求已发送”.通过NSLog,但我的朋友没有收到它.

有任何想法吗?

解决方法 我注意到通知消息只出现在Facebook App App和AndroID / iOS中,但是网络用户看不到它,我希望它不是来自Facebook的实现?另外,为了确保成功发送您的邀请,您必须解析resultURL查询.

NSDictionary *parameters = @{@"to":@""};[FBWebDialogs presentRequestsDialogModallyWithSession:nil                                                      message:SL_FB_INVITE_DESCRIPTION                                                        Title:SL_FB_INVITE_Title                                                   parameters:parameters                                                      handler:^(FBWebDialogResult result,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];                 [alrt release];             }             else             {                 if (![resultURL query])                 {                     return;                 }                 NSDictionary *params = [self parseURLParams:[resultURL query]];                 NSMutableArray *recipIEntIDs = [[[NSMutableArray alloc] init] autorelease];                 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];                     [alrt release];                 }             }         }                                                  frIEndCache:nil];- (NSDictionary *)parseURLParams:(Nsstring *)query{    NSArray *pairs = [query componentsSeparatedByString:@"&"];    NSMutableDictionary *params = [[[NSMutableDictionary alloc] init] autorelease];    for (Nsstring *pair in pairs)    {        NSArray *kv = [pair componentsSeparatedByString:@"="];        [params setobject:[[kv objectAtIndex:1] stringByReplacingPercentEscapesUsingEnCoding:NSUTF8StringEnCoding]                   forKey:[[kv objectAtIndex:0] stringByReplacingPercentEscapesUsingEnCoding:NSUTF8StringEnCoding]];    }    return params;}
总结

以上是内存溢出为你收集整理的从facebook中的iOS应用程序邀请Facebook用户:邀请未被发送全部内容,希望文章能够帮你解决从facebook中的iOS应用程序邀请Facebook用户:邀请未被发送所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1060434.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存