使用Swift 4.0编译的模块无法在Swift 4.0.1中导入 [英] Module compiled with Swift 4.0 cannot be imported in Swift 4.0.1

查看:1680
本文介绍了使用Swift 4.0编译的模块无法在Swift 4.0.1中导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

但是我已经使用相同的Xcode重新编译了框架,它仍然给我这个错误。

However I have recompiled the framework using the same Xcode and it still gives me this error.


  • 基础SDK iOS 11.1用于

  • Swift语言版本Swift 4.0 for both

  • 不使用Pods / Carthage

我希望有人知道

推荐答案

更新:

对于Xcode的发布版本:

此错误(以及涉及Swift 4.1,4.2的类似错误,使用Xcode 9.1,9.2,9.3,9.4,10等打开项目时会出现使用早期Xcode工具构建的框架。

This error (and similar errors involving Swift 4.1, 4.2, etc.) will occur when opening a project with Xcode 9.1, 9.2, 9.3, 9.4, 10, etc. that uses frameworks that were built with earlier Xcode tools.

To使用Carthage( carthage update --platform iOS )解决问题,更新和重建框架,Cocoapods( pod update pod install ),或使用新更新的Xcode工具手动完成。更新Xcode时应自动更新这些工具,但如果没有,您可以按照原始答案中列出的步骤进行更新。

To fix the issue, update and rebuild your frameworks using Carthage ( carthage update --platform iOS), Cocoapods (pod update or pod install), or manually, with the new updated Xcode tools. The tools should be updated automatically when you update Xcode, but if not, you can follow the steps outlined below in the original answer.

您可能还需要清理项目 cmd + shift + k 可能还有你的构建文件夹 cmd + option + shift + k 让Xcode不使用缓存框架构建。

You may also need to clean your project cmd + shift + k and possibly your build folder cmd + option + shift + k to get Xcode to not use cached framework builds.

在某些情况下,您可能还需要删除派生数据文件夹(通过转到Xcode首选项 - >位置 - >派生数据文件夹轻松找到
(谢谢Stunner)

In some cases you may also need to delete your derived data folder (Easily found by going to Xcode Preferences -> Locations -> Derived Data Folder (Thanks Stunner)

对于Xcode的测试版:

请参阅下面的原始答案,然后按照上述步骤操作。

See original answer below and then follow steps above.

原始答案:

您可能还有xcodebuild工具设置为Xcode 9.0,它使用Swift 4.0构建,与Xcode 9.1 beta的Swift 4.0.1不兼容。

You probably still have your xcodebuild tools set to Xcode 9.0 which builds with Swift 4.0 and is incompatible with Xcode 9.1 beta's Swift 4.0.1.

使用以下命令检查终端:

Check in the terminal using the command:

xcodebuild -version

或者只是进入Xcode首选项 - >位置并检查/更改命令行工具到Xcode 9.1。然后你应该设置。

Or just go into Xcode preferences -> Locations and check/change the command line tools to Xcode 9.1. You should be set then.

这篇关于使用Swift 4.0编译的模块无法在Swift 4.0.1中导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆