【问题标题】:App builded by Xcode version 13 crashed on ios 12由 Xcode 版本 13 构建的应用程序在 ios 12 上崩溃
【发布时间】:2021-11-18 23:55:01
【问题描述】:

我的应用在 iOS 15 和 14 上运行良好,也许 13 也是。但是当我在使用 iOS 12 的旧设备上运行时,它在启动时崩溃,甚至在触发 didFinishLaunchingWithOptions 之前。上次我使用 Xcode 12 构建时它运行良好。

Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UINavigationBarAppearance because no class named UINavigationBarAppearance was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' terminating with uncaught exception of type NSException

【问题讨论】:

    标签: xcode ios12 ios15 xcode13 uinavigationbarappearance


    【解决方案1】:

    在 Xcode 13 中,故事板编辑器(以及故事板本身)包含有关导航栏外观 (UINavigationBarAppearance) 的信息:

    但是iOS 12没有这个类,所以这个storyboard不兼容在iOS 12下运行。

    您可以通过让情节提要向后兼容 iOS 12 来摆脱这种情况:

    但我没有亲自尝试过,所以不能保证。

    【讨论】:

    • 太棒了!谢谢你的澄清。但是设置向后兼容不起作用。好像我需要找到其他方法来设置 UINavigationBar
    • 是的,我并不感到惊讶。只是不要使用这个故事板功能。让我知道会发生什么。
    • 非常感谢,你刚刚救了我。令人难以置信的是,Apple 不关心让您知道这些潜在问题。我刚刚发现我们的应用程序因此在 iOS 12 中崩溃,就在它被上传发布时。差点把自己拉出来。
    猜你喜欢
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 2019-03-02
    • 2017-01-17
    • 1970-01-01
    • 1970-01-01
    • 2022-12-13
    • 1970-01-01
    相关资源
    最近更新 更多