ld:警告:找不到自动链接的库'swiftObjectiveC'

时间:2019-03-26 10:35:57

标签: ios objective-c swift xcode

我正在用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

1 个答案:

答案 0 :(得分:0)

以下是对我有用的解决方案:

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

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