我正在尝试发送 FB 请求,但 FBWebDialog 呈现了我以前从未见过的 UI。我不确定我做错了什么。我检查了通常的嫌疑人:
- 脸书应用设置
- 捆绑标识符
- Facebook 显示名称
- 脸书AppID
- URLTypes, URL Schemes
我用来发送请求的代码:
- (void)sendRequest {
NSError *error;
NSData *jsonData = [NSJSONSerialization
dataWithJSONObject:@{
@"social_karma": @"5",
@"badge_of_awesomeness": @"1",
@"request_action": @"1"}
options:0
error:&error];
if (!jsonData) {
NSLog(@"JSON error: %@", error);
return;
}
NSString *giftStr = [[NSString alloc]
initWithData:jsonData
encoding:NSUTF8StringEncoding];
NSMutableDictionary* params = [@{@"data" : giftStr} mutableCopy];
// Display the requests dialog
[FBWebDialogs
presentRequestsDialogModallyWithSession:nil
message:@"Please send me some Energy!"
title:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or sending the 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);
}
}
}
}];
}
我看到的用户界面:
相同的 UI,滚动到底部:
我希望看到的 UI(使用 FB 示例应用程序的同一设备):