简体   繁体   English

Swift 框架通过 Cocoapods 添加到 Objective-C 应用程序中 - “未找到模块”

[英]Swift Framework Added via Cocoapods into Objective-C App - "Module not found"

In Xcode 8 I'm having trouble importing any Swift 2.3 or 3 framework that was added with Cocoapods into my project.在 Xcode 8 中,我无法将随 Cocoapods 添加到我的项目中的任何 Swift 2.3 或 3 框架导入。

There is a public umbrella.h file, but for some reason Xcode can't find the framework when I try to @import it.有一个公共的umbrary.h 文件,但由于某种原因,当我尝试@import 时,Xcode 找不到该框架。

As an example, create any Objective-C project, use the following Podfile, pod install, and then try the @import .例如,创建任何 Objective-C 项目,使用以下 Podfile,pod install,然后尝试@import It asks me to update the code to swift 2.3 or 3 even if that code is already Swift 2.3 or Swift 3 code.它要求我将代码更新为 swift 2.3 或 3,即使该代码已经是 Swift 2.3 或 Swift 3 代码。 I've cleaned and tried to rebuild as well.我也清理过并尝试重建。

platform :ios, '8.0'
use_frameworks!

target 'testingFrameworks' do
  pod 'SwiftyJSON'
end

Did I miss a step?我错过了一步吗?

I used socketIO and was having the same problem.我使用了 socketIO 并且遇到了同样的问题。 My solution to this is:我对此的解决方案是:

  1. Close project.关闭项目。
  2. Delete pod files, delivered files, pod framework, workspace file (clean up project)删除pod文件、交付文件、pod框架、工作空间文件(清理项目)
  3. pod install吊舱安装
  4. Reopen workspace, upgrade swift syntax if xcode ask for, build a few times.重新打开工作区,如果 xcode 要求升级 swift 语法,构建几次。

You might need to fix something for the new swift.您可能需要为新的 swift 修复一些东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM