2

我的应用在 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

4

1 回答 1

4

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

在此处输入图像描述

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

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

在此处输入图像描述

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

于 2021-09-26T15:32:00.813 回答