使用 Swift Package Manager 的 Swift IOS 库无法编译

标签 swift alamofire swift-package-manager

我们正在开发一个用 swift 构建的 iOS 框架。为了方便组网,我们需要在项目中导入alamofire。 我们编译库的方式是同时构建 sim 和设备,然后使用 lipo 合并 2。到目前为止我尝试过的:

  1. 克隆 Alamofire 项目,使用项目策略:针对两个平台进行编译并使用 lipo。在我们尝试导出导入它的项目的 IPA 之前,这种方法效果非常好。

ld: symbol(s) not found for architecture arm64
    Exited with 1


error: Failed to compile bundle: /var/folders/8k/89s55x7s3x9c0k0gv5n9vzbh0000gn/T/Alamofirehyhhbn/Alamofire.arm64.xar


Stderr:

>
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:297:in `run'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2703:in `block in CompileOrStripBitcodeInBundle'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2642:in `each'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2642:in `CompileOrStripBitcodeInBundle'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2902:in `block in ProcessIPA'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2864:in `each'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:2864:in `ProcessIPA'
/Applications/Xcode-11.2.app/Contents/Developer/usr/bin/ipatool:3811:in `<main>'}

** EXPORT FAILED **
  • 尝试使用Carthage编译Alamofire。它确实有效,直到导出。发生了同样的问题。

  • 决定使用 Swift Package Manager,它可以正常构建简单的框架,即使是从终端,但当我们想要使用聚合器时,它会失败:

  • xcodebuild: error: Could not resolve package dependencies:
    The operation couldn’t be completed. (Basic.Process.Error error 0.)
    
    

    我很困惑,无法弄清楚这一点。

    查看演示 https://www.dropbox.com/s/ll4ld4ryespbelr/Test%20Import.zip?dl=0

    最佳答案

    我已经查看了演示,您需要更改脚本并删除“env -i”。之后就可以工作了

    关于使用 Swift Package Manager 的 Swift IOS 库无法编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58767939/

    相关文章:

    swift - 如何在 SwiftUI 中添加自定义容器 View

    ios - 如何使用 [String : Any] parameters 构造多部分表单数据请求

    swift - 如何修复 Xcode 错误 : Value of type 'AVAudioRecorder?' has no member 'URL'

    Swift 3 使用 Alamofire 将数据上传到服务器

    ios - Alamofire 图片 : Placeholder image is not set for af_setImageWithURL

    swift - 如何通过包管理器安装 Swift 包?

    ios - Swift 从特定相册中选择所有照片

    ios - 如何在 Swift 中解析来自 Alamofire API 的 JSON 响应?

    swift - 在 SPM(Swift 包管理器)中导入 .framework

    objective-c - 如何使用 SwiftPM 在 objective-c 模块中使用 swift 模块?