繁体   English   中英

向多个用户IOS发送Facebook请求时出错

[英]Error sending facebook request to multiple users IOS

我无法将FB请求发送给多个用户,但不断收到“发生错误,请稍后重试”。

该代码看起来像这样,并且仅在尝试发送给单个用户时才可以正常工作。

- (void)sendRequest:(NSArray *) targeted {

NSMutableDictionary* params =
[[NSMutableDictionary alloc]init];

if (targeted != nil && [targeted count] > 0) {
    NSString *selectIDsStr = [targeted componentsJoinedByString:@","];
    [params setObject:selectIDsStr forKey:@"to"];
}

// Display the requests dialog
[FBWebDialogs
 presentRequestsDialogModallyWithSession:nil
 message:@"Learn how to make your iOS apps social."
 title:nil
 parameters:params
 handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
     if (error) {
         // Error launching the dialog or sending request.
         NSLog(@"Error sending request.");
     } else {
         if (result == FBWebDialogResultDialogNotCompleted) {
             // User clicked the "x" icon
             NSLog(@"User canceled request.");
         } else {
             // Handle the send request callback
             NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
             if (![urlParams valueForKey:@"request"]) {
                 // User clicked the Cancel button
                 NSLog(@"User canceled request.");
             } else {
                 // User clicked the Send button
                 NSString *requestID = [urlParams valueForKey:@"request"];
                 NSLog(@"Request ID: %@", requestID);
             }
         }
     }
 }];

}

有谁知道如何解决这个问题?

尝试这个

presentRequestsDialogModallyWithSession:[FBSession activeSession]

在那里,一个真正愚蠢的错误导致了这一点。 我将FB用户ID存储为整数,这显然不是一个好主意,因为ID可能很大。

如果ID正确,它就可以正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM