我有一个使用 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];
该应用程序将加载对话框,但在 FBWebDialogs.m:93 处的 [FBWebDialogInternalDelegate completeWithResult:url:error:] 上崩溃:当您点击 X 按钮取消对话框或尝试发送请求时。
我是否需要添加任何依赖项,以某种新方式开始会话,链接他们在https://developers.facebook.com/docs/tutorial/iossdk/upgrading-from-3.2-中没有告诉您的内容或其他内容to-3.5/ ?
谢谢。