gpt4 book ai didi

ios - Facebook iOS SDK 3.5.1 好友请求对话框在关闭时崩溃

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:58:56 25 4
gpt4 key购买 nike

我有一个使用 Facebook SDK 的 iOS 应用程序。我从 3.2 升级到 3.5.1 部分是为了允许我使用无摩擦的好友请求。该过程适用于:

NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys:nil];

[FBWebDialogs presentRequestsDialogModallyWithSession:[FBSession activeSession]
message:[NSString stringWithFormat:@"I just posted an action - give me some points!"]
title:@"Get Points from your friends"
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Case A: Error launching the dialog or sending request.
NSLog(@"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// Case B: User clicked the "x" icon
NSLog(@"User canceled request.");
} else {
NSLog(@"Request Sent.");
}
}}];

但是一旦我添加好友缓存(从 Facebook 网站复制/粘贴):

    NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys:nil];



FBFrictionlessRecipientCache *friendCache = [[FBFrictionlessRecipientCache alloc] init];
[friendCache prefetchAndCacheForSession:nil];

[FBWebDialogs presentRequestsDialogModallyWithSession:[FBSession activeSession]
message:[NSString stringWithFormat:@"I just posted an action - give me some points!"]
title:@"Get points from your friends"
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Case A: Error launching the dialog or sending request.
NSLog(@"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// Case B: User clicked the "x" icon
NSLog(@"User canceled request.");
} else {
NSLog(@"Request Sent.");
}
}}
friendCache:friendCache];

当您点击 X 按钮取消对话框或尝试发送请求时,应用程序将加载对话框但在 [FBWebDialogInternalDelegate completeWithResult:url:error:] at FBWebDialogs.m:93: 崩溃。

我是否需要添加任何依赖项、以某种新方式启动 session 、链接他们在 https://developers.facebook.com/docs/tutorial/iossdk/upgrading-from-3.2-to-3.5/ 中未告诉您的内容或任何其他内容? ?

谢谢。

最佳答案

很确定在这种情况下,这是因为您没有在任何地方保留 friendCache,并且它在 FBWebDialogs 尝试使用它之前被释放(例如当对话框被关闭时)。

如果您将 friendCache 移动到类中的 ivar 或属性而不是局部变量,这应该可以工作。

关于ios - Facebook iOS SDK 3.5.1 好友请求对话框在关闭时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16444497/

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