【问题标题】:Could not find or use auto-linked library '..." after installing react-native-fbsdk安装 react-native-fbsdk 后找不到或使用自动链接库“...”
【发布时间】:2020-09-11 12:12:06
【问题描述】:

我正在尝试通过 npm 安装 react-native-fbsdk,虽然我之前的构建工作完美,但一旦我安装了库并安装了 pod,我收到以下错误:

ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftsimd'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftPhotos'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftAVFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'
ld: warning: Could not find or use auto-linked library 'swiftCoreMIDI'
ld: warning: Could not find or use auto-linked library 'swiftCoreLocation'
Undefined symbols for architecture x86_64:
  "protocol descriptor for Foundation.CustomNSError", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "method descriptor for static Foundation.CustomNSError.errorDomain.getter : Swift.String", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "method descriptor for Foundation.CustomNSError.errorUserInfo.getter : [Swift.String : Any]", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "method descriptor for Foundation.CustomNSError.errorCode.getter : Swift.Int", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "base conformance descriptor for Foundation.CustomNSError: Swift.Error", referenced from:
      protocol conformance descriptor for __C_Synthesized.related decl 'e' for FBSDKLoginError : Foundation.CustomNSError in __C_Synthesized in libFBSDKLoginKit.a(LoginManager.o)
  "protocol descriptor for Foundation._ErrorCodeProtocol", referenced from:

... etc

我到处寻找解决这个问题的方法,但我没有看到如何解决这个库问题。

我正在使用 React Native .60.5 - 这个问题有什么解决方案吗?

【问题讨论】:

  • 你安装的FBSDK版本支持哪个React-Native版本?您可能需要降级 FBSDK 或升级 RN。
  • github也有同样的问题,但现在没有答案。
  • 暂时降级到react-native-fbsdk的v1.1.2和fbsdk的5.8.0已经解决了问题

标签: react-native fbsdk


【解决方案1】:

要解决这个问题,您只需要在您的 Xcode 项目中添加 swift 文件 和 ** "Create Bridging Header"**。

  • 打开 Xcode 并在你的项目下选择 New file 并选择 swift file
  • 现在清理您的构建并创建新构建。

或者您可以查看下面的链接以很好地理解这一点

Why linker link static libraries with errors? iOS

【讨论】:

    【解决方案2】:

    我通过adding a .swift file via xcode修复了这个问题

    1. 打开 XCode 项目
    2. 新建文件,选择swift文件
    3. 确认“创建桥接头”
    4. 干净
    5. 构建

    我尝试了这些步骤的一些组合,但发现我需要所有(即必须通过 xcode 完成,您确实需要桥接头,并且您确实需要清理构建文件夹)。

    【讨论】:

      猜你喜欢
      • 2022-12-10
      • 1970-01-01
      • 2018-03-10
      • 1970-01-01
      • 1970-01-01
      • 2021-09-04
      • 2019-10-30
      • 1970-01-01
      • 2021-11-16
      相关资源
      最近更新 更多