我创建了一个 React Native 模块 RNKin
。我尝试通过 Pods 安装这个模块/库的依赖项。
Pod文件
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'demo_pods' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
use_modular_headers!
# Pods for demo_pods
pod 'KinEcosystem', '0.5.4'
pod 'JWT', '3.0.0-beta.11'
pod 'Alamofire'
end
子项目(我的 RNKin 库)在 .swift 文件中导入这些 pod 框架(KinEcosystem、Alamofire、JWT)(如屏幕截图所示) 但是,当我尝试构建 demo_pods 项目时,它失败并出现错误“No such module xxx”。
我尝试了框架/标题搜索路径的每种组合。我不知道出了什么问题:(
完整安装的项目可以在这里下载:https://www.dropbox.com/s/ixy0tip3etb8sb3/demo_pods.zip?dl=0 (pods和node_modules已经安装)
经过几天的尝试和错误,我发布此内容希望有人能帮助我,那太棒了! =)
最佳答案
修复了我的Podfile
:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!
use_modular_headers!
workspace 'demo_pods.xcworkspace'
def shared_pods
pod 'KinEcosystem', '0.5.4'
pod 'JWT', '3.0.0-beta.11'
pod 'Alamofire'
end
target 'demo_pods' do
shared_pods
target 'RNKin' do
project '../node_modules/react-native-kin/ios/RNKin.xcodeproj'
inherit! :search_paths
end
end
关于ios - 子项目找不到通过 Pods 安装的 Swift 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52855780/