我正在使用 Xcode 12.2,并正在开发一个 Swift 静态框架(.xcframework
最终嵌入到 a 中),我打算使用 CocoaPods 来提供它。
我的问题目前不是应用程序项目中的 CocoaPods 集成(pod install
正常工作并且应用程序构建和运行),而是使用pod lib lint
命令验证 pod。
lint
验证失败,日志包含以下内容:
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
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 'swiftAccelerate'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$__TtCs12_SwiftObject", referenced from:
[...]
并且日志包含与
Undefined symbols for architecture arm64
我的.podspec
文件如下
Pod::Spec.new do |s|
s.name = 'MyFramework'
s.version = '1.0.0'
s.source = { :git => 'https://url-to-repo.git', :tag => s.version.to_s }
s.ios.deployment_target = '12.0'
s.platform = :ios
s.swift_version = '5.0'
s.requires_arc = true
s.static_framework = true
s.ios.vendored_frameworks = "MyFramework.xcframework"
s.frameworks = 'AVFoundation', 'Accelerate', 'CoreGraphics', 'CoreImage'
s.ios.library = 'z', 'c++'
end
我的猜测是 CocoaPods 创建的项目是使用 Objective-C 的,可能不会引用 Swift 编译器或库。但我不知道如何解决这个问题..
我一直在这方面失去了几天,任何帮助将不胜感激。
谢谢