【问题标题】:Dyld Library Not Loaded Error on Release Build发布版本时未加载 Dyld 库错误
【发布时间】:2016-03-23 13:45:58
【问题描述】:

我有一个仅在调试配置中使用 SimulatorStatusMagic 的项目。所以我的 Podfile 有以下行:

pod 'SimulatorStatusMagic', :configurations => ['Debug']

该应用程序在模拟器中运行良好,但是当我为我的设备编译或上传到 iTunes 时,我收到以下错误:

Dyld 消息:库未加载: @rpath/SimulatorStatusMagic.framework/SimulatorStatusMagic
参考自: /var/mobile/Containers/Bundle/Application/1E47674A-D9AB-4390-B365-85C1D9035624/

我做错了什么?

【问题讨论】:

  • Stack Overflow 上现有的 CocoaPods "Dyld Library Not Loaded" 答案都没有帮助你吗?
  • 不,他们没有。看看答案有多疯狂!类似的错误消息有很多不同的问题。 stackoverflow.com/questions/26024100/…

标签: ios xcode swift cocoapods


【解决方案1】:

我找到了解决问题的方法。在 AppDelegate.swift 中,我有以下代码:

    if (Helper.isUITest) {
        UIView.setAnimationsEnabled(false)
        SDStatusBarManager.sharedInstance().enableOverrides()
    }

尽管 Helper.isUITest 总是为 Release 构建返回 false,但编译器并不知道这一点,并且仍然发出元数据/代码以动态加载 SimulatorStatusMagic 框架。

将上述代码封装在#if DEBUG 中解决了这个问题。

    #if DEBUG
    if (Helper.isUITest) {
        UIView.setAnimationsEnabled(false)
        SDStatusBarManager.sharedInstance().enableOverrides()
    }
    #endif

【讨论】:

    猜你喜欢
    • 2014-07-25
    • 1970-01-01
    • 2015-12-20
    • 2018-11-07
    • 2012-04-23
    • 2011-02-27
    • 2017-06-30
    • 2020-06-15
    相关资源
    最近更新 更多