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

Dar*_*rko 8 xcode facebook ios

我试图邀请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 *)alertView
didDismissWithButtonIndex:(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.");
                                                          }
                                                      }}];


}
Run Code Online (Sandbox Code Playgroud)

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

有任何想法吗?

小智 0

你什么时候填充参数?

我知道如果您发送空白 Facebook 用户名作为收件人,FB API 会友好地发送已完成的操作