Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Perfect + Swift3 开发后端,我想加载一个带有配置的文本文件。当我在 Xcode8 中运行项目时,id 没有检测到文本文件。但是,当我为 linux 构建应用程序时,它工作正常。调试后我发现问题是 Xcode 没有将文本文件复制到其构建目录。请让我知道如何让 Xcode 将其复制到构建目录并使其易于访问。
let lines = try! String(contentsOfFile: ").components(separatedBy: "\n")
请转到 Xcode - 项目(我的 Mac) - 编辑方案 - 运行 - 工作目录 - 使用自定义工作目录 - $(PROJECT_DIR),如屏幕截图: