简体   繁体   English

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

[英]Error sending facebook request to multiple users IOS

I don't manage to send FB request to multiple users, keeps getting "An error occured, please try again later". 我无法将FB请求发送给多个用户,但不断收到“发生错误,请稍后重试”。

The code looks like this, and it work just fine when only trying to send to a single user. 该代码看起来像这样,并且仅在尝试发送给单个用户时才可以正常工作。

- (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);
             }
         }
     }
 }];

} }

Does anyone have a clue how to approach this? 有谁知道如何解决这个问题?

尝试这个

presentRequestsDialogModallyWithSession:[FBSession activeSession]

There where a really stupid mistake causing this. 在那里,一个真正愚蠢的错误导致了这一点。 I was storing FB user ids as ints and that's obviously not a good idea since the ids can be really big. 我将FB用户ID存储为整数,这显然不是一个好主意,因为ID可能很大。

It works just fine if the ids are correct. 如果ID正确,它就可以正常工作。

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

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