[英]App crashes on iOS 12 and below after building with Xcode 13
An app which was running successfully on iOS 9-15 now crashes on launch on iOS 9-12 when building with Xcode 13.1 (on M1 Pro) that I just upgraded to.在 iOS 9-15 上成功运行的应用程序现在在使用 Xcode 13.1 构建时在 iOS 9-12 上启动时崩溃(我刚刚升级到 M1 Pro)。
It crashes on unarchive of the main storyboard due to use of UITabBarAppearance which only exists on iOS 13+ (see trace below).由于使用了仅存在于 iOS 13+ 上的 UITabBarAppearance,它在取消归档主 storyboard 时崩溃(请参见下面的跟踪)。 My storyboard entry point is a Tab Bar Controller.
我的 storyboard 入口点是标签栏 Controller。
I have not edited my storyboard file since this was working on iOS 9-15 with previous Xcode versions and the crash occurs before any of my code runs.我没有编辑我的 storyboard 文件,因为这是在 iOS 9-15 上与以前的 Xcode 版本一起工作的,并且在我的任何代码运行之前发生崩溃。
In the hope it was a simulator-only issue (I have no old-iOS devices) I uploaded to the store but the app crashes on launch on real devices too on iOS12 and below.希望这是一个仅限模拟器的问题(我没有旧的 iOS 设备)我上传到商店,但应用程序在 iOS12 及更低版本的真实设备上启动时也会崩溃。 https://apps.apple.com/nz/app/campermate-australia-nz/id1586561660
https://apps.apple.com/nz/app/campermate-australia-nz/id1586561660
Minimum OS target is 9.0.最低操作系统目标是 9.0。 We could drop support for iOS 9-11 but we still have plenty of iPhone 6 and 5 users (who are limited to iOS 12).
我们可以放弃对 iOS 9-11 的支持,但我们仍然有大量 iPhone 6 和 5 用户(仅限于 iOS 12)。
How can I fix this?我怎样才能解决这个问题?
2021-12-15 10:51:09.526554+1300 TTG_Explore_Australia[36783:2248622] libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.
2021-12-15 10:51:09.954515+1300 TTG_Explore_Australia[36783:2248622] *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UITabBarAppearance because no class named UITabBarAppearance 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)'
*** First throw call stack:
(
0 CoreFoundation 0x0000000113cae8db __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000113259ac5 objc_exception_throw + 48
2 CoreFoundation 0x0000000113cae735 +[NSException raise:format:] + 197
3 UIFoundation 0x00000001176626c9 UINibDecoderDecodeObjectForValue + 360
4 UIFoundation 0x0000000117662af9 UINibDecoderDecodeObjectForValue + 1432
5 UIFoundation 0x0000000117662554 -[UINibDecoder decodeObjectForKey:] + 251
6 UIKitCore 0x000000011ca0c827 -[UINib instantiateWithOwner:options:] + 1306
7 UIKitCore 0x000000011cf28594 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
8 UIKitCore 0x000000011cd8c809 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 111
9 UIKitCore 0x000000011cd8ccb1 -[UIApplication _loadMainInterfaceFile] + 274
10 UIKitCore 0x000000011cd8b3e5 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1360
11 UIKitCore 0x000000011c5cfa4e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
12 UIKitCore 0x000000011c5d8346 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
13 UIKitCore 0x000000011c5cf664 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
14 UIKitCore 0x000000011c5cffc0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
15 UIKitCore 0x000000011c5ce332 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
16 UIKitCore 0x000000011c5cdfe9 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
17 UIKitCore 0x000000011c5d2d2e __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
18 UIKitCore 0x000000011c5d3988 _performActionsWithDelayForTransitionContext + 100
19 UIKitCore 0x000000011c5d2a95 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
20 UIKitCore 0x000000011c5d7a48 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
21 UIKitCore 0x000000011cd89dc8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
22 UIKitCore 0x000000011c94102f -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
23 FrontBoardServices 0x000000011aeb4d25 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
24 FrontBoardServices 0x000000011aebead6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
25 FrontBoardServices 0x000000011aebe300 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
26 libdispatch.dylib 0x0000000114cc4db5 _dispatch_client_callout + 8
27 libdispatch.dylib 0x0000000114cc82ba _dispatch_block_invoke_direct + 300
28 FrontBoardServices 0x000000011aef00da __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
29 FrontBoardServices 0x000000011aeefd92 -[FBSSerialQueue _performNext] + 451
30 FrontBoardServices 0x000000011aef0327 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
31 CoreFoundation 0x0000000113c15db1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
32 CoreFoundation 0x0000000113c15633 __CFRunLoopDoSources0 + 243
33 CoreFoundation 0x0000000113c0fcef __CFRunLoopRun + 1231
34 CoreFoundation 0x0000000113c0f4d2 CFRunLoopRunSpecific + 626
35 GraphicsServices 0x00000001169e62fe GSEventRunModal + 65
36 UIKitCore 0x000000011cd8cfc2 UIApplicationMain + 140
37 TTG_Explore_Australia 0x0000000100e63dd8 main + 104
38 ??? 0x0000000202b024fe 0x0 + 8635032830
39 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UITabBarAppearance because no class named UITabBarAppearance 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
CoreSimulator 776.4 - Device: iPhone 8 Plus (B0A6FB7E-392D-40E7-AC7C-B6AF109ABE60) - Runtime: iOS 12.4 (16G73) - DeviceType: iPhone 8 Plus
At the bottom of the stack trace it says:在堆栈跟踪的底部它说:
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: ' Could not instantiate class named UITabBarAppearance because no class named UITabBarAppearance was found ;
*** 由于未捕获的异常“NSInvalidUnarchiveOperationException”而终止应用程序,原因:“无法实例化名为 UITabBarAppearance 的 class,因为找不到名为 UITabBarAppearance 的 class ; 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
class 需要在源代码中定义或从库中链接(确保 class 是正确目标的一部分)'以 NSException 类型的未捕获异常终止
UITabBarAppearance
was introduced in iOS 13, so it won't work with older iOS versions. UITabBarAppearance
是在 iOS 13 中引入的,因此它不适用于较旧的 iOS 版本。 Check your code for any occurrences of UITabBarAppearance
and either remove them or wrap in an if #available
.检查您的代码中是否出现任何
UITabBarAppearance
并将它们删除或包装在if #available
中。 It could also be a problem with the storyboard using UITabBarAppearance
internally. storyboard 在内部使用
UITabBarAppearance
也可能是一个问题。
XCode had sneakily inserted these into my storyboard file without my knowledge! XCode 在我不知情的情况下偷偷地将这些插入到我的 storyboard 文件中!
<tabBarAppearance key="standardAppearance"/>
and和
<navigationBarAppearance key="standardAppearance"/>
Deleting these fixed it.删除这些修复它。 I set appearance for iOS13+ in my code within a version check.
我在版本检查中的代码中设置了 iOS13+ 的外观。
I resolved this by manually adding LinkPresentation.framework to "Link Binary with Libraries" in build phase, and setting its status to Optional.我通过在构建阶段手动将 LinkPresentation.framework 添加到“Link Binary with Libraries”并将其状态设置为 Optional 来解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.