我正在尝试熟悉 Swift 包管理器。
这就是我所做的:
swift package init --type executable
一切都很好,但在我尝试之后import Dependency
在代码中 xcode 说:没有这样的模块。
我的 Package.swift 看起来像:
import PackageDescription
let package = Package(
name: "todo-bot",
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/zmeyc/telegram-bot-swift.git", from: "0.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
named: "todo-bot",
dependencies: ["telegram-bot-swift"]),
]
)
当我尝试在没有 xcode 的情况下构建它时,它会出现
- Compile Swift Module 'SwiftyJSON' (2 sources)
- 编译 Swift 模块“ScannerUtils”(2 个来源)
- 编译 Swift 模块“TelegramBot”(135 个来源)
- 编译 Swift 模块“todo_bot”(1 个来源)
/opt/local/include/curl/system.h:399:12:注意:在构建从 /opt/local/include/curl/system.h:399 导入的模块“Darwin”时:#
包括
^
:338:9: 注意:在 :338 包含的文件中:#
导入“ncurses.h”
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/ncurses.h:141:10:注意:在 /Applications/Xcode 包含的文件中。应用程序/内容/开发人员/平台/MacOSX.platform/开发人员/SDKs/MacOSX10.13.sdk/usr/include/ncurses.h:141:#
包括
^
/opt/local/include/unctrl.h:60:63:错误:未知类型名称“SCREEN”
NCURSES_EXPORT(NCURSES_CONST 字符) NCURSES_SP_NAME(unctrl) (屏幕,chtype);
^
/opt/local/include/curl/system.h:399:12:注意:在构建从 /opt/local/include/curl/system.h:399 导入的模块“Darwin”时:
'#' 包括
^
我今天也注意到这个问题也出现在我身上。我按照以下步骤来消除此错误。
- Close
Xcode
应用
- 删除
.xcodeproj
file
- 通过运行再次重新生成包
swift package generate-xcodeproj
.
下次您打开时Xcode
项目包将被正确安装,并且您不会遇到任何构建问题。不确定这会对某人有帮助,但我希望它能:)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)