gpt4 book ai didi

swift - 尝试根据第三方框架构建基于 Swift 的命令行工具时出现构建错误 : this target might include its own product

转载 作者:行者123 更新时间:2023-11-30 11:51:35 25 4
gpt4 key购买 nike

上下文:我想使用 CryptoSwift 创建一个简单的 Swift 命令行工具。我对 Xcode 和 Swift(以及 MacOS!)还比较陌生。

配置:
- MacOS High Sierra 10.13.2
- Xcode:9.2

步骤:

  1. 我启动 Xcode
  2. 为 MacOS 创建一个新项目“命令行工具”
  3. 我的项目选项:
    • 产品名称:cryptodemo
    • 组织标识符:com.demo
    • 语言 Swift
  4. 我将项目创建到 ~/Documents
  5. 将我的 main.swift 填充为:

    import Foundation
    import CryptoSwift

    print("Hello, World!")

    let bytes:Array<UInt8> = [0x01, 0x02, 0x03]
    let digest = Digest.md5(bytes)
  6. 打开 shell 并进入 ~/Documents/cryptodemo

  7. 将 CryptoSwift 添加为 project’s README 定义的子模块使用:git子模块添加https://github.com/krzyzanowskim/CryptoSwift.git
  8. 打开 Finder 并将 CryptoSwift.xcodeproj 文件拖到我的 Xcode 项目中
  9. 在 Xcode 中,我进入我的项目构建阶段

    • 我添加了 CryptoSwift 作为目标依赖项
    • 我将 CryptoSwift.framework 添加到将二进制文件与库链接
    • 我将 CryptoSwift.framework 添加到 Copy Files 中:
      • 目的地:框架
      • 子路径:(空) enter image description here
  10. 然后我构建它。我有这个错误:

    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.

    enter image description here

这是该项目的存档cryptodemo.zip

最佳答案

删除步骤 9 并将 CryptoSwift.framework 添加到“链接的框架和库

enter image description here

就像这里: enter image description here

关于swift - 尝试根据第三方框架构建基于 Swift 的命令行工具时出现构建错误 : this target might include its own product,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48282733/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com