ios - 子项目找不到通过 Pods 安装的 Swift 模块

标签 ios swift xcode react-native cocoapods

我创建了一个 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”。

enter image description here

我尝试了框架/标题搜索路径的每种组合。我不知道出了什么问题:(

完整安装的项目可以在这里下载: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/

相关文章:

iphone - UITableview疑惑

swift - 光标移动到编辑格式化十进制文本字段时结束 - Swift

ios - 无法设置(keyPath)此类上的用户定义的检查属性不符合键 keyPath 的键值编码

objective-c - 创建仅使用非英语语言的应用程序的正确方法

ios - 在人像模式下检测到风景(模拟器)

ios - 从正在删除的 UITableViewCell 中获取标题

iOS Swift UI 更新延迟

xcode - Mac终端返回 "xcrun: error: unable to exec Xcode native xcrun (Exec format error)."

ios - 在 iOS 中再次显示权限对话框

ios - Swift - 函数 viewWillAppear