我正在从事一个用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
发布于 2019-03-26 12:35:43
这里有一个对我有用的解决方案:
显然,对于纯objective项目,您需要将这个$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)添加到目标的库搜索路径中。当我把一个库写成目标-c中的一个项目时,这个方法对我起了作用。
https://stackoverflow.com/questions/55355030
复制相似问题