如何使用 Cocoapods 基于两个静态库制作一个动态框架(Swift)
How to make a dynamic framework(Swift) based on two static libraries using Cocoapods
我想制作一个动态框架,将两个第 3 方框架与静态库结合在一起,然后将其作为 pod 添加到我的项目中。
这是他们的 podspec 文件
- IndoorsSDK-iOS.podspec(顺便说一下,这个在.framework文件中缺少modulemap)
- IndoorAtlas.podspec
我试图将它们作为 s.dependency
添加到我的 podspec 文件中,但出现以下错误
Pods error - target has transitive dependencies that include static binaries
尝试将它们作为 s.vendored_frameworks
包括在内,但得到关注 https://github.com/CocoaPods/CocoaPods/issues/6409 并且无法使用给定的解决方案进行解决。
你能指导一下我该如何处理吗,稍后我会
post 一些测试项目可以更仔细地研究问题。现在我有太多不同的测试项目不起作用,我什至不知道要 post 到 Github 显示什么。
在我的大多数尝试中,我最终无法在我的框架 swift 文件中使用导入 IndoorsSDK/IndoorAtlas,因为 “没有这样的模块” 错误.
感谢任何帮助。
终于,我找到了解决方案。所以,如果有人 运行 遇到类似的问题,我 post 在这里。
我的 podspec
文件除了其他行包含以下
#// one library added as dependency, another as vendored_frameworks
#// because it lacks modulemap, so it was added manually to IndooRS framework
spec.dependency 'IndoorAtlas'
spec.vendored_frameworks = 'SKNavigation/Frameworks/IndoorsSDK.framework'
#// following lines fix linking issues so our pod would see dependency modules
spec.pod_target_xcconfig = {
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) $(SRCROOT)/**',
'OTHER_LDFLAGS' => '$(inherited) -undefined dynamic_lookup'
}
和 modulemap
,添加到缺少它的框架中
module IndoorsSDK [system] {
header "Headers/IndoorsSDK.h"
header "Headers/Indoors.h"
export *
link framework "CoreMotion"
link framework "CoreBluetooth"
link "c++"
}
最新一点,podfile
应该包含以下内容以隐藏传递依赖项错误。
pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies; end
end
大概就这些了。
我想制作一个动态框架,将两个第 3 方框架与静态库结合在一起,然后将其作为 pod 添加到我的项目中。 这是他们的 podspec 文件
- IndoorsSDK-iOS.podspec(顺便说一下,这个在.framework文件中缺少modulemap)
- IndoorAtlas.podspec
我试图将它们作为 s.dependency
添加到我的 podspec 文件中,但出现以下错误
Pods error - target has transitive dependencies that include static binaries
尝试将它们作为 s.vendored_frameworks
包括在内,但得到关注 https://github.com/CocoaPods/CocoaPods/issues/6409 并且无法使用给定的解决方案进行解决。
你能指导一下我该如何处理吗,稍后我会 post 一些测试项目可以更仔细地研究问题。现在我有太多不同的测试项目不起作用,我什至不知道要 post 到 Github 显示什么。
在我的大多数尝试中,我最终无法在我的框架 swift 文件中使用导入 IndoorsSDK/IndoorAtlas,因为 “没有这样的模块” 错误.
感谢任何帮助。
终于,我找到了解决方案。所以,如果有人 运行 遇到类似的问题,我 post 在这里。
我的 podspec
文件除了其他行包含以下
#// one library added as dependency, another as vendored_frameworks
#// because it lacks modulemap, so it was added manually to IndooRS framework
spec.dependency 'IndoorAtlas'
spec.vendored_frameworks = 'SKNavigation/Frameworks/IndoorsSDK.framework'
#// following lines fix linking issues so our pod would see dependency modules
spec.pod_target_xcconfig = {
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) $(SRCROOT)/**',
'OTHER_LDFLAGS' => '$(inherited) -undefined dynamic_lookup'
}
和 modulemap
,添加到缺少它的框架中
module IndoorsSDK [system] {
header "Headers/IndoorsSDK.h"
header "Headers/Indoors.h"
export *
link framework "CoreMotion"
link framework "CoreBluetooth"
link "c++"
}
最新一点,podfile
应该包含以下内容以隐藏传递依赖项错误。
pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies; end
end
大概就这些了。