ios - 包产品“MyLibrary”不能用作此目标的依赖项,因为它使用了不安全的构建标志
问题描述
我正在尝试为我的库添加 SPM 支持。我需要为unsafeFlags
我的库的一个目标定义(为了将 Swift 代码导入到 Objective-C++ 中):
.target(name: "MyLibrary",
dependencies: ["MyOtherTarget"],
cSettings: [
.unsafeFlags(["-fmodules", "-fcxx-modules"]),
.define("BUILDING_FOR_SPM")
]
),
生成的包构建。但是当我将它导入主机应用程序时,它无法构建,因为
The package product 'MyLibrary' cannot be used as a dependency of this target because it uses unsafe build flags.
根据这篇文章和相应的拉取请求,该问题已在 Swift 4 中得到解决。我使用的是 Xcode 12.5 和 Swift 5。
发生什么了?
解决方案
.unsafeFlags
不允许使用版本指定的依赖项。解决方法是使用提交哈希指定版本。
在https://forums.swift.org/t/override-for-unsafeflags-in-swift-package-manager/45273上有关 monorepos 的详细讨论和另一种解决方法
推荐阅读
- javascript - 尽管已填充,Javascript 无法访问 Html 表单数据
- python - 使用多个数据帧时如何优化 PySpark?
- asp.net - Database.Migrate 方法
- javascript - 是否可以使用 Neo4j 实现模式建模?
- javascript - 基于 es6 在网站上绑定 dom 事件的最佳方法是什么?
- javascript - 如何根据条件将查询链接到 mongoDB 数据库(mongoose)
- javascript - React 和 Django - 将 Note 模型与特定用户连接
- java - Thymeleaf 模板显示来自 PostgreSQL 数据库的数据时出现问题
- python - 你将如何在 pygame 中制作水平/垂直滚动条?
- python - 如何将参数传递给终端?