Facebook iOS SDK-向Facebook用户发送应用请求

| 我试图使用facebook iOS SDK通过facebook发送一个应用程序请求,我使用以下代码:
NSString *message = [[NSString alloc] initWithFormat:@\"blah blah blah\"];
NSString *data = [[NSString alloc] initWithFormat:@\"blah blah blah\"];

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:message, @\"message\", data, @\"data\", nil];
[_facebook requestWithGraphPath:[NSString stringWithFormat:@\"%@/apprequests\",userID] andParams:params andHttpMethod:@\"POST\" andDelegate:self];

[message release];
[data release];
这给我以下错误:
Error: Error Domain=facebookErrDomain Code=10000 \"The operation couldn’t be completed. (facebookErrDomain error 10000.)\" UserInfo=0x788c5b0 {error=<CFBasicHash 0x788c080 [0x1bf53e0]>{type = mutable dict, count = 2,
entries =>
    2 : <CFString 0x788b560 [0x1bf53e0]>{contents = \"type\"} = <CFString 0x788c3f0 [0x1bf53e0]>{contents = \"OAuthException\"}
    3 : <CFString 0x788c560 [0x1bf53e0]>{contents = \"message\"} = <CFString 0x788c480 [0x1bf53e0]>{contents = \"(#200) Invalid Request: There was a problem with the parameters of the request. Body of an error/warning message. Title is: Invalid Request\"}
}
那么,有没有人成功完成此任务,或者您知道使用Facebook iOS SDK向Facebook用户发送请求的方法吗? 谢谢     
已邀请:
        您可以使用Facebook SDK轻松轻松地发送应用程序请求 对于发出应用程序请求,请确保遵循以下步骤 1)确保已在应用程序文件夹中添加了最新的Facebook SDK 如果没有,您可以从此链接下载。 现在,您只需要在项目文件夹中添加FBConnect文件夹。 2)然后确保已将iphone应用程序注册为“ Facebook上的应用程序”,然后选择 您的应用在“基本应用设置”下与Facebook集成。 如果没有,您可以在这里进行。
NSString *friendId=@\"FacebookId Of Your Friends\";

NSLog(@\"%@\",friendId);

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@\"Hi please add me as a friend.\",  @\"message\",
                                   friendId, @\"to\",
                                   nil];
 [appDelegate.facebook dialog:@\"apprequests\" andParams:params  andDelegate:self];
请不要忘记在ViewController类中首先采用FBdialogDelegate协议。     
        没有对话框,仅使用POST方法就无法发送应用程序请求。 根据文档: 该SDK提供了一种弹出Facebook对话框的方法。当前支持的对话框是授权流程中使用的登录和权限对话框,以及用于将帖子发布到用户的feed的对话框。 因此,您也无法通过标准对话框发布应用程序请求。它仅适用于Web应用程序。     
        andyc,使用这种方式,您只能发送App请求。 并且请确保您已将您的应用注册为\“ Facbook上的应用\”。 问题是,为了使通知显示在桌面网站上,您的Facebook App需要定义一个Canvas URL。该URL甚至不需要有效,只需在应用程序的“设置”中定义即可。我已经通过测试应用验证了确实可以解决问题。这是Facebook有意完成的,因为当用户单击通知时,会将他们发送到桌面网站上的Canvas URL 我已经以相同的方式进行操作,并且在我的通知中收到了App请求。 还是您在发送应用程序请求时遇到问题,请查看以下链接 “请求”对话框报告成功,收件人什么也没收到     
        我能够使用Ruby通过标准POST向/ me / apprequests发送请求。我为应用程序和\“ message \”参数提供了有效的access_token。 iOS SDK可能还没有对话框。 注意:用户必须先安装应用程序一次,然后才能向他们发送通知和邀请。所以安德鲁是正确的。目前尚无法发送应用请求以邀请某人加入新应用。     
        试试这个代码,
NSDictionary *params = @{@\"to\":text};

NSString *message = @\"MESSAGE\";
NSString *title = @\"TITLE\";

[FBWebDialogs presentRequestsDialogModallyWithSession:nil
                                              message:message
                                                title:title
                                           parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
 {
     if (error)
     {
         UIAlertView *Alert = [[UIAlertView alloc]initWithTitle:@\"Alert\" message:@\"Request not sent\" delegate:nil cancelButtonTitle:@\"Ok\" otherButtonTitles:nil, nil];
         [Alert show];
     }
     else
     {
         if (result == FBWebDialogResultDialogNotCompleted)
         {
             // Case B: User clicked the \"x\" icon
             UIAlertView *Alert = [[UIAlertView alloc]initWithTitle:@\"Alert\" message:@\"Canceled request\" delegate:nil cancelButtonTitle:@\"Ok\" otherButtonTitles:nil, nil];
             [Alert show];
             NSLog(@\"User canceled request.\");
         }
         else
         {
             UIAlertView *Alert = [[UIAlertView alloc]initWithTitle:@\"Success\" message:@\"Request sent successfully\" delegate:nil cancelButtonTitle:@\"Ok\" otherButtonTitles:nil, nil];
             [Alert show];
             NSLog(@\"Request Sent. %@\", params);
         }
     }
 }];
    

要回复问题请先登录注册