Xcode 9 _OBJC_CLASS_$_FBSDKApplicationDelegate

Xcode 9 _OBJC_CLASS_$_FBSDKApplicationDelegate

我正在尝试将 Facebook SDK 实施到我的项目中,但我遇到了同样的问题 Facebook sdk is not a dylib error after update update Xcode 7? 好吧,我的 Frameworks 目录中有 Bolts,还有

在我的 Build Settings 中: Frameworks Search Path: ~/Documents/Frameworks/FacebookSDKs-iOS-4.27.0 (这对我来说是正确的)

在我的Briding-Header.h

#import <Bolts/Bolts.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

但是,我仍然遇到同样的错误,另外,我刚刚删除了 Derived data

错误是:

ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKCoreKit.framework/FBSDKCoreKit', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKCoreKit.framework/FBSDKCoreKit is not a dylib
ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/Bolts.framework/Bolts', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/Bolts.framework/Bolts is not a dylib
ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKLoginKit.framework/FBSDKLoginKit', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKLoginKit.framework/FBSDKLoginKit is not a dylib
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FBSDKApplicationDelegate", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

有人知道这个错误吗?

好吧,解决方案很奇怪,基本上,我删除了 Framework 组中的拖放,然后添加了 FBSDKCoreKitFBSDKLoginKitBolt使用常规设置将它们添加到 Linked Frameworks and Libraries

我没有使用FB官方参考中描述的方法,而是使用pods安装它们,我轻松解决了这个问题

我也遇到了这个错误,清理项目并重新构建它 4-5 次对我有用。

  • 清理 - Command + Shift + K

  • 建筑 - 命令 + B

另一种解决方案是删除项目文件夹中的这些文件:enter image description here

  • pod 安装