【问题标题】:ld: warning: Could not find auto-linked library 'swiftObjectiveC'ld:警告:找不到自动链接库“swiftObjectiveC”
【发布时间】:2019-03-26 10:35:57
【问题描述】:

我正在开发一个用 obj-c 编写的遗留项目(iOS 应用程序)。该项目与用 obj-c 编写的遗留静态库链接。

该库使用 Swift 编写的代码进行了扩展,并且构建时没有错误。

问题出在项目级别,构建时出现以下错误:

ld: warning: Could not find auto-linked library 'swiftObjectiveC'
ld: warning: Could not find auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find auto-linked library 'swiftCoreAudio'
ld: warning: Could not find auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find auto-linked library 'swiftCore'
ld: warning: Could not find auto-linked library 'swiftQuartzCore'
ld: warning: Could not find auto-linked library 'swiftDarwin'
ld: warning: Could not find auto-linked library 'swiftsimd'
ld: warning: Could not find auto-linked library 'swiftFoundation'
ld: warning: Could not find auto-linked library 'swiftAVFoundation'
ld: warning: Could not find auto-linked library 'swiftCoreMedia'
ld: warning: Could not find auto-linked library 'swiftDispatch'
ld: warning: Could not find auto-linked library 'swiftCoreFoundation'
Undefined symbols for architecture x86_64:
  "protocol descriptor for Swift.Hashable", referenced from:
      protocol conformance descriptor for __C.AVAudioSessionCategory : Swift.Hashable in __C_Synthesized in libFindParking.a(libFindParking.a-x86_64-master.o)
      generic protocol witness table for __C.AVAudioSessionCategory : Swift.Hashable in __C_Synthesized in libFindParking.a(libFindParking.a-x86_64-master.o)
      protocol conformance descriptor for __C.AVAudioSessionMode : Swift.Hashable in __C_Synthesized in libFindParking.a(libFindParking.a-x86_64-master.o)
      generic protocol witness table for __C.AVAudioSessionMode : Swift.Hashable in __C_Synthesized in libFindParking.a(libFindParking.a-x86_64-master.o)
  • 如何解决问题?

更新:

我没有使用 Cocoapods

【问题讨论】:

    标签: ios objective-c swift xcode


    【解决方案1】:

    这是一个对我有用的解决方案:

    显然,对于纯 Objective-c 项目,您需要将此 $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) 添加到目标的库搜索路径中。当我将一个用swift编写的库包含在objective-c中的项目中时,这对我有用

    https://stackoverflow.com/a/53101587/1180728

    【讨论】:

    • 我这样做了,但仍然遇到同样的错误,一直在尝试将 adMob 广告到目标 C 项目。 ld:警告:找不到自动链接的框架“FBLPromises”
    • 所以,你有另一个极端情况。
    猜你喜欢
    • 2020-02-23
    • 1970-01-01
    • 2023-03-11
    • 2013-06-08
    • 2017-06-29
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 2017-10-19
    相关资源
    最近更新 更多