[英]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.