我正在尝试熟悉Swift Package Manager。 这就是我所做的:
swift package init --type executable
swift build
一切都很好,但在我尝试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的情况下构建它时,
- 编译Swift模块'SwiftyJSON'(2个来源)
- 编译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 /开发商/软件开发工具包/ MacOSX10.13.sdk / usr / include目录/ ncurses.h:141:#
包括 ^ /opt/local/include/unctrl.h:60:63:错误:未知类型名称'SCREEN' NCURSES_EXPORT(NCURSES_CONST char )NCURSES_SP_NAME(unctrl)(SCREEN ,chtype); ^ /opt/local/include/curl/system.h:399:12:注意:在构建模块'Darwin'时从/opt/local/include/curl/system.h:399导入: '#'包括 ^
答案 0 :(得分:2)
今天我也注意到这个问题。我遵循以下步骤来消除此错误。
case "CLICKHIT": {
//Create an audio object from the url provided to the action.
//Get the url from the action
const sound = new Audio(action.url);
//Play the audio object immediatly
sound.play();
return state;
}
应用程序Xcode
文件.xcodeproj
重新生成软件包。下次打开swift package generate-xcodeproj
项目时,将正确安装软件包,并且不会出现任何构建问题。不确定这是否会帮助某人,但我希望能做到这一点:)