【发布时间】:2015-07-05 13:08:46
【问题描述】:
我仍在我的项目中使用 Objective-C,因为它是一个遗留项目。我以前使用 Parse,现在我正在尝试添加 FB 集成。我设法编译了所有东西——这些是我通过 CocoaPods 安装的。
Using Bolts (1.2.0)
Installing FBSDKCoreKit (4.3.0)
Installing FBSDKLoginKit (4.3.0)
Using Parse (1.7.5)
Installing ParseFacebookUtilsV4 (1.7.5)
这是我的代码。
FirstViewController
-(void) viewDidAppear:(BOOL)animated
{
// Do any additional setup after loading the view, typically from a nib.
if (![PFUser currentUser] || // Check if user is cached
![PFFacebookUtils isLinkedWithUser:[PFUser currentUser]]) { // Check if user is linked to Facebook
PFLogInViewController *logInController = [[PFLogInViewController alloc] init];
logInController.fields = (PFLogInFieldsUsernameAndPassword
| PFLogInFieldsFacebook
| PFLogInFieldsDismissButton);
[self presentViewController:logInController animated:YES completion:nil];
[self presentViewController:loginViewController animated:YES completion:NULL];
} else {
NSLog(@"User is cached and showing content.");
}
}
当视图显示并单击使用 Facebook 登录时,出现此错误。
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You must initialize PFFacebookUtils with a call to +initializeFacebookWithApplicationLaunchOptions'
如果我在我的 AppDelegate 上添加这个,
[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions];
我遇到编译问题 - 没有已知的类。
基于 this,我应该在 PFFacebookUtils 中添加一个临时 hack,但该文件中不存在 initializeFacebookWithApplicationLaunchOptions 方法。
我也尝试在我的 AppDelegate 中添加它。
[PFFacebookUtils initializeFacebook];
在这种情况下,错误是:
+[PFFacebookUtils initializeFacebook]: unrecognized selector sent to class 0x10024f420
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[PFFacebookUtils initializeFacebook]: unrecognized selector sent to class 0x10024f420'
有什么想法/解决方案吗?
【问题讨论】:
-
您是否在 .plist 中正确设置了 Facebook 应用 ID?您可以查看Getting Started documentation。
标签: ios facebook parse-platform