背景:我想使用CryptoSwift创建一个简单的 Swift 命令行工具 我对 Xcode 和 Swift(以及 MacOS!)相对较新。
配置:
- MacOS High Sierra 10.13.2
- Xcode:9.2
脚步:
- 我开始 Xcode
- 为 MacOS 创建一个新项目“命令行工具”
- 我的项目的选项:
- 产品名称:密码演示
- 组织标识符:com.demo
- 语言斯威夫特
- 我将项目创建为
~/Documents
填写我的 main.swift :
import Foundation import CryptoSwift print("Hello, World!") let bytes:Array<UInt8> = [0x01, 0x02, 0x03] let digest = Digest.md5(bytes)
打开外壳进入
~/Documents/cryptodemo
- 添加 CryptoSwift 作为项目自述文件定义的子模块,使用:
git submodule add https://github.com/krzyzanowskim/CryptoSwift.git
- 打开 Finder 并将
CryptoSwift.xcodeproj
文件拖到我的 Xcode 项目中 在 Xcode 中,我进入我的项目
Build Phase
然后我建立它。我有这个错误:
Check dependencies Unable to run command 'PBXCp CryptoSwift.framework' - this target might include its own product. Unable to run command 'CodeSign A' - this target might include its own product.