使用根视图控制器初始化 UINavigationController 时,应用崩溃

App is crashing when UINavigationController is initialised with root view controller

提问人:Harsh Sharma 提问时间:5/22/2020 最后编辑:Harsh Sharma 更新时间:5/22/2020 访问量:224

问:

从应用程序委托 didfinishlaunching 调用的方法,在 iOS 13.4、iPad 第 5 代上,initWithRootViewController 应用程序崩溃。这个问题不是每次都来。我从 firebase crashlytics 得到了这个堆栈异常跟踪。

从应用程序委托 didfinishlaunching 调用的方法,在 iOS 13.4、iPad 第 5 代上,initWithRootViewController 应用程序崩溃。这个问题不是每次都来。我从 firebase crashlytics 得到了这个堆栈异常跟踪。

- (void)userLoginUsingNewData
{
    LoginViewController *loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];

    self.mainNavigationController = [[UINavigationContrller alloc] initWithRootViewController:loginViewController];
    [self.mainNavigationController setNavigationBarHidden:YES];
    [self.window setRootViewController:_MAGICBOX.mainNavigationController];
    [self.window makeKeyAndVisible];
}

Fatal Exception: NSInvalidArgumentException
-[__NSCFType fontDescriptorByAddingAttributes:]: unrecognized selector sent to instance 0x280183420

堆栈跟踪

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x197058a48 __exceptionPreprocess
1  libobjc.A.dylib                0x196d7ffa4 objc_exception_throw
2  CoreFoundation                 0x196f5c5a8 -[NSOrderedSet initWithSet:copyItems:]
3  CoreFoundation                 0x19705caf4 ___forwarding___
4  CoreFoundation                 0x19705ea7c _CF_forwarding_prep_0
5  UIFoundation                   0x19a67530c __UIFontDescriptorWithTextStyle
6  UIFoundation                   0x19a62f6f0 +[UIFontDescriptor preferredFontDescriptorWithTextStyle:addingSymbolicTraits:options:]
7  UIKitCore                      0x19b42fe40 _ensureLargeFontGlobals.llvm.1284539462740725553
8  UIKitCore                      0x19b42f9ec __UIInnerNavTitleAppearanceAddDefaultLargeTitleAttributes
9  UIKitCore                      0x19a8350f0 -[_UINavigationBarVisualProviderModernIOS prepare]
10 UIKitCore                      0x19a7e5bac -[UINavigationBar _commonNavBarInit]
11 UIKitCore                      0x19a7e5d04 -[UINavigationBar initWithFrame:]
12 UIKitCore                      0x19aa24828 -[UINavigationController _navigationBarHiddenByDefault:]
13 UIKitCore                      0x19aa2b8e4 -[UINavigationController loadView]
14 UIKitCore                      0x19aac3c5c -[UIViewController loadViewIfRequired]
15 UIKitCore                      0x19aac4360 -[UIViewController view]
16 UIKitCore                      0x19aa39c54 -[UINavigationController pushViewController:transition:forceImmediate:]
17 UIKitCore                      0x19aa398ac -[UINavigationController pushViewController:animated:]
18 UIKitCore                      0x19aa1cdd8 -[UINavigationController initWithRootViewController:]
19 SMP eReader                    0x100a4dff4 +[AppLaunch userLoginUsingNewData] + 160 (AppLaunch.m:160)
20 SMP eReader                    0x100a4d894 +[AppLaunch setupAppRootViewWithAppUpgrade] + 108 (AppLaunch.m:108)
21 SMP eReader                    0x100ae5140 -[AppDelegate application:didFinishLaunchingWithOptions:] + 42 (AppDelegate.m:42)
22 UIKitCore                      0x19b0d4ee4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:]
23 UIKitCore                      0x19b0d6ca0 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:]
24 UIKitCore                      0x19b0dc42c -[UIApplication _runWithMainScene:transitionContext:completion:]
25 UIKitCore                      0x19a8a9208 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:]
26 UIKitCore                      0x19ad3f698 _UIScenePerformActionsWithLifecycleActionMask
27 UIKitCore                      0x19a8a9cf0 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke
28 UIKitCore                      0x19a8a9748 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
29 UIKitCore                      0x19a8a9b1c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
30 UIKitCore                      0x19a8a93d8 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
31 UIKitCore                      0x19a8ad8c4 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2
32 UIKitCore                      0x19ac70f08 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:]
33 UIKitCore                      0x19ad58c84 _UISceneSettingsDiffActionPerformChangesWithTransitionContext
34 UIKitCore                      0x19a8ad5fc __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke
35 UIKitCore                      0x19ad58b80 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext
36 UIKitCore                      0x19a8ad468 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]
37 UIKitCore                      0x19a71f2c0 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke
38 UIKitCore                      0x19a71de28 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:]
39 UIKitCore                      0x19a71eff8 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:]
40 UIKitCore                      0x19b0da7e4 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:]
41 UIKitCore                      0x19ac91900 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:]
42 FrontBoardServices             0x19c18b7a0 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:]
43 FrontBoardServices             0x19c1b0838 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154
44 FrontBoardServices             0x19c195f04 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
45 FrontBoardServices             0x19c1b04f4 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke
46 libdispatch.dylib              0x196d25184 _dispatch_client_callout
47 libdispatch.dylib              0x196ccdfd8 _dispatch_block_invoke_direct$VARIANT$mp
48 FrontBoardServices             0x19c1d5418 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
49 FrontBoardServices             0x19c1d50e4 -[FBSSerialQueue _queue_performNextIfPossible]
50 FrontBoardServices             0x19c1d560c -[FBSSerialQueue _performNextFromRunLoopSource]
51 CoreFoundation                 0x196fd6a00 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
52 CoreFoundation                 0x196fd6958 __CFRunLoopDoSource0
53 CoreFoundation                 0x196fd60f0 __CFRunLoopDoSources0
54 CoreFoundation                 0x196fd123c __CFRunLoopRun
55 CoreFoundation                 0x196fd0adc CFRunLoopRunSpecific
56 GraphicsServices               0x1a0f71328 GSEventRunModal
57 UIKitCore                      0x19b0de63c UIApplicationMain
58 SMP eReader                    0x100b5f82c main + 14 (main.m:14)
59 libdyld.dylib                  0x196e5a360 start
IOS Objective-C UIAnageController

评论

0赞 Larme 5/22/2020
UINavigationContrller:是自定义还是错别字错误?“ iOS 13.4,iPad 5”:仅在此设备 + iOS 版本上?你能重现它吗?
0赞 Harsh Sharma 5/22/2020
UINavigationContrller 是 iOS 的原生组件。不,我无法重现它,我从 Firebase Crashlytics 获得了此日志。

答: 暂无答案