【问题标题】:Xcode 9 Archive process failsXcode 9存档过程失败
【发布时间】:2017-10-13 12:03:37
【问题描述】:

我正在开发一个最初在 Xcode 8.3 和 Swift 3.2 中启动的项目,在 Xcode 9(稳定版)发布后,我使用 Xcode 9 中的内置选项将我的项目从 Swift 3.2 转换为 Swift 4.0。它也转换了像 Alamofire、SwiftyJson 等 pod。我还使用 pod update 命令更新了所有 pod。
在模拟器和 iPhone 上一切都运行良好,但是当我尝试归档项目时,归档过程失败并出现如下错误。Error Image1 Error Image2


我已经尝试了所有可能的解决方案,例如更改目标和 Pod 构建设置的 Swift 语言版本、优化级别,但是它没有用。
我也尝试过在我的 pod 文件中。

swift_32 = ['Alamofire', 'AlamofireImage', 'AssistantKit'] # if these pods are in Swift 3.2
swift4 = ['SwiftyJSON'] # if these pods are in Swift 4

post_install do |installer|

    installer.pods_project.targets.each do |target|
        swift_version = nil

        if swift_32.include?(target.name)
            swift_version = '3.2'
        end

        if swift4.include?(target.name)
            swift_version = '4.0'
        end

        if swift_version
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = swift_version
            end
        end
    end
end


构建和运行项目有效,但只有存档过程因上述错误而失败。

【问题讨论】:

  • 请将您收到的错误消息添加为文本而不是屏幕截图。

标签: xcode9 swift4


【解决方案1】:

我有类似的问题。我能够在安装了 pod 的情况下运行我的 Xcode 项目,即Alamofire, SwiftyJson 等,但是每次我尝试归档该过程时都会显示上述错误而失败。问题的原因在于 cocoapods。
完全删除 cocoapods 并重新安装它解决了我的问题。

从 MacOS 中彻底移除 cocoapods:
1. 在终端输入gem list --local | grep cocoapods。您会在终端中看到类似这样的内容:

cocoapods (1.3.1)
cocoapods-core (1.3.1)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.3)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.0)
cocoapods-try (1.1.0)

  1. 现在您需要使用以下命令逐个删除每个 gem。

sudo gem 卸载 cocoapods
sudo gem 卸载 cocoapods-deintegrate
sudo gem 卸载 cocoapods-downloader

  1. 同时删除 ~/.cocoapods 以移除 podspecs 的缓存。这将删除旧的主仓库。

rm -rf ~/.cocoapods/

  1. 从您的 Xcode 项目中删除 pod 并删除 Podfile。我还删除了我的 .xcworkspace。

pod deintegrate
rm Podfile

  1. 现在重新安装 cocoapods,使用:

sudo gem install cocoapods
pod setup --verbose

将所需的 pod 添加到您的项目并尝试存档。
希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2017-03-13
    • 1970-01-01
    • 2017-03-21
    • 2019-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-11
    • 1970-01-01
    相关资源
    最近更新 更多