Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift包无法为watchOS编译_Swift_Xctest_Watchos_Swift Package Manager - Fatal编程技术网

Swift包无法为watchOS编译

Swift包无法为watchOS编译,swift,xctest,watchos,swift-package-manager,Swift,Xctest,Watchos,Swift Package Manager,选择watchOS目标时,我的Swift包无法编译 错误消息为加载模块“XCTest”失败,生成错误详细信息为: /Applications/Xcode beta.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator6.0.sdk/usr/lib/swift/XCTest.swiftftmodule/i386.swiftinterface:6:19:XCTest在构建watc

选择watchOS目标时,我的Swift包无法编译

错误消息为加载模块“XCTest”失败,生成错误详细信息为:

/Applications/Xcode beta.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator6.0.sdk/usr/lib/swift/XCTest.swiftftmodule/i386.swiftinterface:6:19:XCTest在构建watchOS模拟器时不可用。如果使用目标环境(McActActuScript)<代码>在构建MAC催化剂时有条件地导入该框架。

watchOS中没有XCTest,所以我需要为watchOS编译Swift包吗?

这是一个完全的黑客行为,但我在开发过程中解决这个问题的一种方法是临时注释掉Package.Swift文件中的
.testTarget(名称:dependencies:)
类型方法。之后,清理build文件夹,然后构建并运行watchOS

我还为自己留下了一个
#警告
,以确保在提交任何Swift包之前取消注释


(值得补充的是,这是在
#if!os(watchOS)
条件中包装所有测试代码之外的。)

Hello@TruMan1,您找到解决方案了吗?不,这仍然是一个问题,不幸的是,用
#if!包装我的所有测试!操作系统(watchOS)