Crashlytics reported the following error:
Fatal Exception: NSInvalidArgumentException - [_ UIFieldEditorLayoutManager addTextContainer:] unrecognized selector sent to the instance
...
My question is: How can I control this Exception? Greetings.
Code:
-(void) method{
NSError *authError = nil;
LAContext *laCtx = [[LAContext alloc] init];
if ([laCtx canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
...
}
} else {
[txtField becomeFirstResponder];
self.navigationItem.hidesBackButton = NO;
}
}
The report shows the crash in the line: self.navigationItem.hidesBackButton = NO;
. But I think it has to do with the text field (due to the error message).
The crash report indicates:
- 0 iosApp 0x4e8221 CLSProcessRecordAllThreads + 4362785
- 1 iosApp 0x4e8221 CLSProcessRecordAllThreads + 4362785
- 2 iosApp 0x4e8119 CLSProcessRecordAllThreads + 4362521
- 3 iosApp 0x4dc05f CLSHandler + 4313183
- 4 iosApp 0x4e6b0b __CLSExceptionRecord_block_invoke + 4356875
- 5 libdispatch.dylib 0x23739b47 _dispatch_client_callout + 22
- 6 libdispatch.dylib 0x23745355 _dispatch_barrier_sync_f_invoke + 56
- 7 iosApp 0x4e650d CLSExceptionRecord + 4355341
- 8 iosApp 0x4e6335 CLSExceptionRecordNSException + 4354869
- 9 iosApp 0x4e5e4b CLSTerminateHandler() + 4353611
- 10 libc++abi.dylib 0x23358e17 std::__terminate(void (*)()) + 78
- 11 libc++abi.dylib 0x233585f5 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 110
- 12 libobjc.A.dylib 0x23366eeb objc_exception_throw + 250
- 13 CoreFoundation 0x23bc5925 __methodDescriptionForSelector + 186
- 14 CoreFoundation 0x23bc3559 __forwarding __ + 700
- 15 CoreFoundation 0x23af3c08 _CF_forwarding_prep_0 + 24
- 16 UIKit 0x27e0bc59 -[UIFieldEditor initWithFrame:] + 584
- 17 UIKit 0x27d1c44d +[UIFieldEditor sharedFieldEditor] + 88
- 18 UIKit 0x27e0b7d5 -[UITextField _becomeFirstResponder] + 184
- 19 UIKit 0x27d8374d -[UIResponder becomeFirstResponder] + 396
- 20 UIKit 0x27d83b29 -[UIView(Hierarchy) becomeFirstResponder] + 132
- 21 UIKit 0x27e0a39d -[UITextField becomeFirstResponder] + 48
- 22 iosApp 0x22a5bd -[MyViewController methodCrashed] (MyViewController.m:175)
- 23 iosApp 0x229fdf __45-[MyViewController methodLCS]_block_invoke (MyViewController.m:91)
- 24 Framework1 0x167a3c9 -[MyViewControllerLCS requestAuthorizationWithHandler:] (MyViewControllerLCS.m:48)
- 25 iosApp 0x229eb5 -[MyViewController methodLCS] (MyViewController.m:106)
- 26 iosApp 0x229e25 -[MyViewController viewDidAppear:] (MyViewController.m:73)
- 27 UIKit 0x27d152af -[UIViewController _setViewAppearState:isAnimating:] + 670
- 28 UIKit 0x27d15837 -[UIViewController _endAppearanceTransition:] + 258
- 29 UIKit 0x27dd0fdb -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 986
- 30 UIKit 0x27eab2d7 __49-[UINavigationController _startCustomTransition:]_block_invoke + 210
- 31 UIKit 0x27e2909f -[_UIViewControllerTransitionContext completeTransition:] + 90
- 32 UIKit 0x27f8ddfb __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke95 + 682
- 33 UIKit 0x27d37b25 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 540
- 34 UIKit 0x27d37605 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 204
- 35 UIKit 0x27d374ff -[UIViewAnimationState animationDidStop:finished:] + 78
- 36 QuartzCore 0x25dfea21 CA::Layer::run_animation_callbacks(void*) + 252
- 37 libdispatch.dylib 0x23739b47 _dispatch_client_callout + 22
- 38 libdispatch.dylib 0x23747ee1 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1524
- 39 CoreFoundation 0x23b833fd _CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE_ + 8
- 40 CoreFoundation 0x23b818f7 __CFRunLoopRun + 1574
- 41 CoreFoundation 0x23ad4bf9 CFRunLoopRunSpecific + 520
- 42 CoreFoundation 0x23ad49e5 CFRunLoopRunInMode + 108
- 43 GraphicsServices 0x24d20ac9 GSEventRunModal + 160
- 44 UIKit 0x27d64ba1 UIApplicationMain + 144
- 45 iosApp 0x342779 main (main.m:14)
- 46 libdispatch.dylib 0x23783873 (Missing)