iOS   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iOS Facebook sdk邀请朋友发送Reqest但未收到Notificaton给朋友大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用facebook SDK使用以下方法从我的iOS原生应用程序向Facebook好友发送App邀请.

-(IBACtion)ShowFiendDialog:(id)sender
{

    NSDictionary *parameters = @{@"to":@""};

    [FBWebDialogs presentrequestsDialogModallyWithSession:FBSession.activeSession
                                                  message:@"my message"
                                                    title:@"my title"
                                               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];
             //[alrt release];
         }
         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];
                 //[alrt release];
             }

         }
     }friendCache:nil];

}

- (NSDictionary *)parseURLParams:(NSString *)query
{
    NSArray *pairs = [query componentsSeparatedByString:@"&"];
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    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本地应用程序中打开Facebook时,没有收到任何通知或消息.我找不到代码中的错误.

请帮帮我.我的错误在哪里,我该如何解决

解决方法

您必须通过传递一些虚拟网址在Facebook上配置您的应用程序,我也面临同样的问题,这样做对我有用. 转到developer.facebook.com,选择你的应用,选择设置,AddPlatform —> addApplication,在那里传递任何虚拟网址,还为您的应用添加图片,该图片显示在应用详细信息scrren的通知中.

大佬总结

以上是大佬教程为你收集整理的iOS Facebook sdk邀请朋友发送Reqest但未收到Notificaton给朋友全部内容,希望文章能够帮你解决iOS Facebook sdk邀请朋友发送Reqest但未收到Notificaton给朋友所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。