gpt4 book ai didi

ios - 使用 FBWebDialogs (Facebook SDK 3.5) 成功发布后的 nil resultURL

转载 作者:可可西里 更新时间:2023-11-01 03:29:38 27 4
gpt4 key购买 nike

我正在将 Facebook 集成到我的应用程序中以共享网站链接。我正在使用 Feed Dialog 来完成此操作,并且我正在学习本教程:
https://developers.facebook.com/docs/howtos/feed-dialog-using-ios-sdk/ .

我已成功登录并发布到 Facebook,但我想在发布成功后添加一条消息。本教程内置了此功能,但每次我发布时,我都会在日志中看到“用户取消发布故事。”,这是用户单击取消时显示的消息。此外,我已经通过调试器确认,即使在成功发布时,处理程序接收到的参数 resultURL 也始终为 nil。

起初我认为这是我的 Facebook 应用程序 中的配置问题,但我决定进行测试。我打开了框架自带的RPSSample,在RPSFriendsViewController的clickInviteFriends方法中的presentRequestsDialogModallyWithSession调用中添加了一个completion handler。 m view controller 并且我在成功的帖子上也得到了一个 nil resultURL

我是不是漏了什么?

我知道 3.5 SDK 版本非常新,但根据文档,我应该在通过 Facebook Web Dialog 发布后获得有效的 resultURL 参数,所以我'我不确定这是一个错误还是我在某处遗漏了一些回调或处理程序。

以防万一,这是我对 Feed Web 对话框 的调用。与教程中的相比,它有一些小的变化(实际上更简单)

- (void)publish: (EntityToShare *)entityToShare {
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
entityToShare.link, @"link",
nil];

// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or publishing a story.
NSLog(@"Error publishing story.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User clicked the "x" icon
NSLog(@"User canceled story publishing.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:@"post_id"]) {
// User clicked the Cancel button
NSLog(@"User canceled story publishing.");
} else {
// User clicked the Share button
NSString *msg = [NSString stringWithFormat:
@"Posted story, id: %@",
[urlParams valueForKey:@"post_id"]];
NSLog(@"%@", msg);
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:@"Result"
message:msg
delegate:nil
cancelButtonTitle:@"OK!"
otherButtonTitles:nil]
show];
}
}
}
}];
}

最佳答案

我们已经对此进行了修复,并将很快推出。

编辑:

这已在 SDK 版本 3.5.1 中修复在这里查看:https://developers.facebook.com/ios/

关于ios - 使用 FBWebDialogs (Facebook SDK 3.5) 成功发布后的 nil resultURL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16180182/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com