Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Application windows are expected to have a root view controller at the end of application launch
Native stack trace:
0 CoreFoundation 0x0000000104e4d1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000112c18031 objc_exception_throw + 48
2 CoreFoundation 0x0000000104e52472 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000105a7d652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x0000000109bd4b96 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3064
5 UIKit 0x0000000109f96e4a __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
6 UIKit 0x000000010a369909 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
7 UIKit 0x0000000109f96a86 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
8 UIKit 0x0000000109f972a7 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
9 UIKit 0x000000010a9084d4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
10 UIKit 0x000000010a90836e -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
11 UIKit 0x000000010a5ec62d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
12 UIKit 0x000000010a7e7387 _performActionsWithDelayForTransitionContext + 100
13 UIKit 0x000000010a5ec4f7 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
14 UIKit 0x000000010a368fb0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
15 UIKit 0x0000000109bd2f0c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
16 UIKit 0x000000010a1a5a97 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
17 FrontBoardServices 0x0000000117f362f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
18 FrontBoardServices 0x0000000117f3ecfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
19 libdispatch.dylib 0x000000011356f779 _dispatch_client_callout + 8
20 libdispatch.dylib 0x0000000113574931 _dispatch_block_invoke_direct + 317
21 FrontBoardServices 0x0000000117f6a470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
22 FrontBoardServices 0x0000000117f6a12e -[FBSSerialQueue _performNext] + 439
23 FrontBoardServices 0x0000000117f6a68e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
24 CoreFoundation 0x0000000104defbb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25 CoreFoundation 0x0000000104dd44af __CFRunLoopDoSources0 + 271
26 CoreFoundation 0x0000000104dd3a6f __CFRunLoopRun + 1263
27 CoreFoundation 0x0000000104dd330b CFRunLoopRunSpecific + 635
28 GraphicsServices 0x00000001165faa73 GSEventRunModal + 62
29 UIKit 0x0000000109bd60b7 UIApplicationMain + 159
30 ??? 0x0000000133339607 0x0 + 5153986055
31 ??? 0x0000000133339373 0x0 + 5153985395
If you are having this error when using Xamarin Forms you should probably check if your initial page is properly constructed. This happens when XF fails to create your initial page and just continues running.
Related
As the title says, my app immediately crashes when run if there is no internet connection/airplane mode is on. The thing is, when I set breakpoints it doesn't even make it to any of my code. Not a single viewDidLoad or even AppDelegate function gets called, and the error message doesn't seem like something that would be related to not having a network connection:
2019-03-21 10:30:20.193955-0500 AppName[98957:977030] *** Terminating
app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Could not load NIB in bundle: 'NSBundle
<bundleFilePath> (loaded)' with name
'BYZ-38-t0r-view-8bC-Xf-vdC''
(I obviously inserted some fake values into their for privacy)
Call stack:
*** First throw call stack:
(
0 CoreFoundation 0x00000001036cb1bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000102c69735 objc_exception_throw + 48
2 CoreFoundation 0x00000001036cb015 +[NSException raise:format:] + 197
3 UIKitCore 0x00000001088edd94 -[UINib instantiateWithOwner:options:] + 497
4 UIKitCore 0x0000000108661452 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
5 UIKitCore 0x0000000108661ddc -[UIViewController loadView] + 177
6 UIKitCore 0x00000001086620ee -[UIViewController loadViewIfRequired] + 175
7 UIKitCore 0x0000000108662940 -[UIViewController view] + 27
8 UIKitCore 0x000000010858134c -[UIPresentationController __sizeClassPair] + 62
9 UIKitCore 0x0000000108675428 -[UIViewController _presentViewController:withAnimationController:completion:] + 2300
10 UIKitCore 0x000000010867874b __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99
11 UIKitCore 0x0000000108678dd9 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 511
12 UIKitCore 0x00000001086786b1 -[UIViewController _presentViewController:animated:completion:] + 173
13 UIKitCore 0x00000001086789f0 -[UIViewController presentViewController:animated:completion:] + 150
14 AppName 0x0000000100f1125e $SSo16UIViewControllerC12DataScoutProE27showDismissiveAlertMesssage7messageySS_tF + 254
15 AppName 0x0000000100e58a97 $S12AppName18HomeViewControllerC10commonInit33_90D4AB13D5DB6EAFA2D0742F81F552BALLyyF + 727
16 AppName 0x0000000100e58462 $S12AppName18HomeViewControllerC5coderACSgSo7NSCoderC_tcfc + 146
17 AppName 0x0000000100e584df $S12AppName18HomeViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 47
18 UIKitCore 0x00000001088ec166 -[UIClassSwapper initWithCoder:] + 246
19 UIFoundation 0x000000010c8f35ad UINibDecoderDecodeObjectForValue + 749
20 UIFoundation 0x000000010c8f32b3 -[UINibDecoder decodeObjectForKey:] + 251
21 UIKitCore 0x00000001088f07b8 -[UIRuntimeConnection initWithCoder:] + 178
22 UIFoundation 0x000000010c8f35ad UINibDecoderDecodeObjectForValue + 749
23 UIFoundation 0x000000010c8f3854 UINibDecoderDecodeObjectForValue + 1428
24 UIFoundation 0x000000010c8f32b3 -[UINibDecoder decodeObjectForKey:] + 251
25 UIKitCore 0x00000001088ee067 -[UINib instantiateWithOwner:options:] + 1220
26 UIKitCore 0x0000000108e228b6 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
27 UIKitCore 0x0000000108c8103a -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 112
28 UIKitCore 0x0000000108c8150c -[UIApplication _loadMainInterfaceFile] + 272
29 UIKitCore 0x0000000108c7fb25 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1357
30 UIKitCore 0x000000010849e4e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
31 UIKitCore 0x00000001084a729c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
32 UIKitCore 0x000000010849e126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
33 UIKitCore 0x000000010849eae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
34 UIKitCore 0x000000010849ccb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795
35 UIKitCore 0x000000010849c95f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
36 UIKitCore 0x00000001084a1a90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584
37 UIKitCore 0x00000001084a280e _performActionsWithDelayForTransitionContext + 100
38 UIKitCore 0x00000001084a17ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221
39 UIKitCore 0x00000001084a693a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
40 UIKitCore 0x0000000108c7e44e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
41 UIKitCore 0x0000000108822d09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
42 FrontBoardServices 0x000000010f55e2da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
43 FrontBoardServices 0x000000010f569443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
44 FrontBoardServices 0x000000010f568b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
45 libdispatch.dylib 0x000000010548a602 _dispatch_client_callout + 8
46 libdispatch.dylib 0x000000010548db78 _dispatch_block_invoke_direct + 301
47 FrontBoardServices 0x000000010f59dba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
48 FrontBoardServices 0x000000010f59d860 -[FBSSerialQueue _performNext] + 457
49 FrontBoardServices 0x000000010f59de40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
50 CoreFoundation 0x0000000103630721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
51 CoreFoundation 0x000000010362ff93 __CFRunLoopDoSources0 + 243
52 CoreFoundation 0x000000010362a63f __CFRunLoopRun + 1263
53 CoreFoundation 0x0000000103629e11 CFRunLoopRunSpecific + 625
54 GraphicsServices 0x000000010c5b71dd GSEventRunModal + 62
55 UIKitCore 0x0000000108c8181d UIApplicationMain + 140
56 AppName 0x0000000100e8e794 main + 68
57 libdyld.dylib 0x0000000105500575 start + 1
)
I really have no clue what it could be. Tried setting a symbolic breakpoint at [UIViewController _loadViewFromNibNamed:bundle:] but that didn't really give any useful insight. Hope someone can help. I should also mention the only thing I'm doing in AppDelegate is instantiating firebase.
Helpful guy over at reddit figured it out for me. Didn't realize but there was an init() function on my initial view controller that the last guy made which checked the internet connection and redirected to a different page if there wasn't one.
I am using fetchRequestTemplate with NSPredicate to get data. I get "Thread 1: signal SIGABRT" on the following bit of code:
fetchRequest.predicate = NSPredicate(format: "userID == %#", userID)
Here is the full description of the problem:
2019-01-18 16:36:54.084567+0300 Chat[62769:8009479] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't modify a named fetch request in an immutable model.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107e811bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000106e73735 objc_exception_throw + 48
2 CoreData 0x00000001077c7217 -[NSFetchRequest(_NSInternalMethods) _throwIfNotEditable] + 71
3 CoreData 0x00000001077c725e -[NSFetchRequest setPredicate:] + 30
4 Chat 0x00000001064d2db7 $S4Chat7MessageC11getMessages3for2inSayACGSgSS_So22NSManagedObjectContextCtFZ
+ 871
5 Chat 0x00000001064d2430 $S4Chat14StorageManagerC12readMessages3forSayAA12MessageModelCGSS_tF + 336
6 Chat 0x00000001064abfa9 $S4Chat20CommunicationManagerCACycfc + 2553
7 Chat 0x00000001064a8130 $S4Chat20CommunicationManagerCACycfC + 64
8 Chat 0x00000001064a80dc globalinit_33_C5FFB30340A1F300E36AFF644D48A8DA_func0 + 28
9 libdispatch.dylib 0x000000010a30a602 _dispatch_client_callout + 8
10 libdispatch.dylib 0x000000010a30c0c4 _dispatch_once_callout + 66
11 libswiftCore.dylib 0x0000000108676ea9 swift_once + 25
12 Chat 0x00000001064a81b4 $S4Chat20CommunicationManagerC06sharedbC0ACvau + 36
13 Chat 0x00000001064d599f $S4Chat11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF
+ 159
14 Chat 0x00000001064d5ac4 $S4Chat11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo
+ 228
15 UIKitCore 0x000000010bd02bde -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
16 UIKitCore 0x000000010bd045cb -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3979
17 UIKitCore 0x000000010bd09c2f -[UIApplication _runWithMainScene:transitionContext:completion:] + 1623
18 UIKitCore 0x000000010b5284e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke
+ 866
19 UIKitCore 0x000000010b53129c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
20 UIKitCore 0x000000010b528126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
21 UIKitCore 0x000000010b528ae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
22 UIKitCore 0x000000010b526cb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke
+ 795
23 UIKitCore 0x000000010b52695f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
24 UIKitCore 0x000000010b52ba90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke
+ 584
25 UIKitCore 0x000000010b52c80e _performActionsWithDelayForTransitionContext + 100
26 UIKitCore 0x000000010b52b7ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]
+ 221
27 UIKitCore 0x000000010b53093a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
28 UIKitCore 0x000000010bd0844e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
29 UIKitCore 0x000000010b8acd09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
30 FrontBoardServices 0x00000001143e82da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
31 FrontBoardServices 0x00000001143f3443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
32 FrontBoardServices 0x00000001143f2b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
33 libdispatch.dylib 0x000000010a30a602 _dispatch_client_callout + 8
34 libdispatch.dylib 0x000000010a30db78 _dispatch_block_invoke_direct + 301
35 FrontBoardServices 0x0000000114427ba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
36 FrontBoardServices 0x0000000114427860 -[FBSSerialQueue _performNext] + 457
37 FrontBoardServices 0x0000000114427e40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
38 CoreFoundation 0x0000000107de6721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
39 CoreFoundation 0x0000000107de5f93 __CFRunLoopDoSources0 + 243
40 CoreFoundation 0x0000000107de063f __CFRunLoopRun + 1263
41 CoreFoundation 0x0000000107ddfe11 CFRunLoopRunSpecific + 625
42 GraphicsServices 0x00000001114271dd GSEventRunModal + 62
43 UIKitCore 0x000000010bd0b81d UIApplicationMain + 140
44 Chat 0x00000001064d7037 main + 71
45 libdyld.dylib 0x000000010a380575 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I'm dealing with a weird crash which I didn't find a solution yet for.
The title of the crash in Organizer is UIKit: __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 316 and the whole stacktrace is below.
I've checked the startController(_:) method from AppDelegate and everything seems to be fine. Is it a constraint issue maybe? What else could it be?
Last Exception Backtrace:
0 CoreFoundation 0x1d57bb38 __exceptionPreprocess + 124 (NSException.m:165)
1 libobjc.A.dylib 0x1c803062 objc_exception_throw + 34 (objc-exception.mm:521)
2 CoreFoundation 0x1d580fcc -[NSObject(NSObject) doesNotRecognizeSelector:] + 118 (NSObject.m:328)
3 CoreFoundation 0x1d57f0be ___forwarding___ + 692 (NSForwarding.m:3126)
4 CoreFoundation 0x1d4a7dc4 _CF_forwarding_prep_0 + 20
5 Foundation 0x1ded2b76 -[NSLayoutAnchor nsli_lowerIntoExpression:withCoefficient:forConstraint:] + 498 (NSLayoutAnchor.m:883)
6 Foundation 0x1de1b142 -[NSLayoutConstraint _lowerIntoExpression:reportingConstantIsRounded:] + 104 (NSLayoutConstraint.m:1723)
7 Foundation 0x1de1addc -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 120 (NSLayoutConstraint.m:1606)
8 Foundation 0x1de265b4 -[NSLayoutConstraint _addToEngine:] + 24 (NSLayoutConstraint.m:1621)
9 UIKit 0x228a88b2 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 316 (NSLayoutConstraint_UIKitAdditions.m:3596)
10 Foundation 0x1de1a97e -[NSISEngine withBehaviors:performModifications:] + 258 (NSISEngine.m:1973)
11 UIKit 0x228a873a __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 502 (NSLayoutConstraint_UIKitAdditions.m:3585)
12 UIKit 0x227aa5e8 -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 216 (NSLayoutConstraint_UIKitAdditions.m:3550)
13 UIKit 0x228e3654 -[UIView(AdditionalLayoutSupport) _initializeHostedLayoutEngine] + 486 (NSLayoutConstraint_UIKitAdditions.m:3333)
14 UIKit 0x228afe20 -[UIView(UIConstraintBasedLayout) _layoutEngine_windowDidChange] + 120 (NSLayoutConstraint_UIKitAdditions.m:563)
15 UIKit 0x227aa6e0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 208 (UIView.m:12461)
16 UIKit 0x227a9ee0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 120 (UIView.m:9478)
17 UIKit 0x227a9d6c -[UIView(Hierarchy) _postMovedFromSuperview:] + 710 (UIView.m:361)
18 UIKit 0x227b527a -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1636 (UIView.m:13256)
19 UIKit 0x227b4bfe -[UIView(Hierarchy) addSubview:] + 726 (UIView.m:9004)
20 UIKit 0x227b420c -[UIWindow addRootViewControllerViewIfPossible] + 506 (UIWindow.m:1498)
21 UIKit 0x227b15b6 -[UIWindow _setHidden:forced:] + 282 (UIWindow.m:1572)
22 UIKit 0x22821154 -[UIWindow makeKeyAndVisible] + 38 (UIWindow.m:4934)
23 MyApp 0x1c3f28 AppDelegate.startController(_:) + 978 (AppDelegate.swift:207)
24 MyApp 0x1cad3c specialized AppDelegate.application(_:didFinishLaunchingWithOptions:) + 3082 (AppDelegate.swift:141)
25 MyApp 0x1c3a18 #objc AppDelegate.application(_:didFinishLaunchingWithOptions:) + 152 (<compiler-generated>:0)
26 UIKit 0x2281d5c0 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 372 (UIApplication.m:1797)
27 UIKit 0x22a1ea46 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3702 (UIApplication.m:2129)
28 UIKit 0x22a23c18 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1636 (UIApplication.m:3625)
29 UIKit 0x22a367c0 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3149 + 36 (UIApplication.m:10365)
30 UIKit 0x22a21356 -[UIApplication workspaceDidEndTransaction:] + 138 (UIApplication.m:2989)
31 FrontBoardServices 0x1ee5cc0e __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 14 (FBSSerialQueue.m:158)
32 FrontBoardServices 0x1ee5cac8 -[FBSSerialQueue _performNext] + 216 (FBSSerialQueue.m:177)
33 FrontBoardServices 0x1ee5cdb2 -[FBSSerialQueue _performNextFromRunLoopSource] + 40 (FBSSerialQueue.m:206)
34 CoreFoundation 0x1d537fd8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8 (CFRunLoop.c:1941)
35 CoreFoundation 0x1d537b00 __CFRunLoopDoSources0 + 420 (CFRunLoop.c:1989)
36 CoreFoundation 0x1d535f4c __CFRunLoopRun + 1156 (CFRunLoop.c:2821)
37 CoreFoundation 0x1d4891aa CFRunLoopRunSpecific + 466 (CFRunLoop.c:3113)
38 CoreFoundation 0x1d488fcc CFRunLoopRunInMode + 100 (CFRunLoop.c:3143)
39 UIKit 0x22816e28 -[UIApplication _run] + 656 (UIApplication.m:2658)
40 UIKit 0x22811a4e UIApplicationMain + 146 (UIApplication.m:4089)
41 MyApp 0x68564 main + 32 (HighlightsDetailViewController.swift:62)
42 libdyld.dylib 0x1cc764e6 _dyld_process_info_notify_release + 26 (dyld_process_info_notify.cpp:327)
Thanks in advance!
I finally solved the problem. Shortly, the crash appeared only on iOS 10.x devices, because some of my .xib files had had set a later version of iOS (11.0 i.e.) in "File Inspector -> Interface Builder Document -> Builds for" instead of the default Deployment Target set in the project settings, which was 10.x of course.
I've got crash logs for my app from App Store. I'm not able to reproduce the crash and having a hard time deciphering it.
Following is the log -
Incident Identifier: AEF0FFDD-77E4-460F-97E4-B97A32EAE36D
CrashReporter Key: 78177aeeda1175c67f4467d02c023a2a165d1a01
Hardware Model: iPhone7,1
Process: Visits [4558]
Path: /private/var/containers/Bundle/Application/81AC75BC-433C-43E7-887D-8FC6BF5B5703/Visits.app/Visits
Identifier: com.x.y
Version: 1.1.1 (1.1.1)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.x.y [1143]
Date/Time: 2018-07-20 22:30:36.6608 +0530
Launch Time: 2018-07-20 22:30:35.9017 +0530
OS Version: iPhone OS 11.4.1 (15G77)
Baseband Version: 6.80.00
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x184136d8c __exceptionPreprocess + 228 (NSException.m:166)
1 libobjc.A.dylib 0x1832f05ec objc_exception_throw + 56 (objc-exception.mm:521)
2 CoreFoundation 0x1840cfd80 -[__NSSingleObjectArrayI objectAtIndex:] + 128 (NSSingleObjectArray.m:16)
3 UIKit 0x18e6b0aa8 -[UITableViewDataSource tableView:cellForRowAtIndexPath:] + 172 (UITableViewDataSource.m:170)
4 UIKit 0x18e3c90f4 -[UITableViewController tableView:cellForRowAtIndexPath:] + 68 (UITableViewController.m:441)
5 UIKit 0x18de130cc -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668 (UITableView.m:13463)
6 UIKit 0x18de12d84 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80 (UITableView.m:13514)
7 UIKit 0x18de11aa0 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2280 (UITableView.m:2599)
8 UIKit 0x18de0d5ec -[UITableView layoutSubviews] + 140 (UITableView.m:8565)
9 UIKit 0x18dd4a6f4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1420 (UIView.m:15239)
10 QuartzCore 0x1882bfe54 -[CALayer layoutSublayers] + 184 (CALayer.mm:9357)
11 QuartzCore 0x1882c3fe4 CA::Layer::layout_if_needed(CA::Transaction*) + 324 (CALayer.mm:9237)
12 UIKit 0x18dd62bf4 -[UIView(Hierarchy) layoutBelowIfNeeded] + 548 (UIView.m:10438)
13 Visits 0x1007a8300 MainViewController.initialSetupForScreen() + 804 (MainViewController.swift:217)
14 Visits 0x1007a7ea4 MainViewController.viewDidLoad() + 924 (MainViewController.swift:175)
15 Visits 0x1007a8838 #objc MainViewController.viewDidLoad() + 28
16 UIKit 0x18dd51e64 -[UIViewController loadViewIfRequired] + 1020 (UIViewController.m:3192)
17 UIKit 0x18dd51a50 -[UIViewController view] + 28 (UIViewController.m:3214)
18 UIKit 0x18dd42ce4 -[UIWindow addRootViewControllerViewIfPossible] + 136 (UIWindow.m:1358)
19 UIKit 0x18dd41b18 -[UIWindow _setHidden:forced:] + 272 (UIWindow.m:1455)
20 UIKit 0x18ddcf62c -[UIWindow makeKeyAndVisible] + 48 (UIWindow.m:4883)
21 UIKit 0x18dd45274 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3660 (UIApplication.m:2210)
22 UIKit 0x18dd125e0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1680 (UIApplication.m:3491)
23 UIKit 0x18e342b1c __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 784 (_UICanvasLifecycleMonitor.m:175)
24 UIKit 0x18dd11dd0 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 160 (_UICanvas.m:591)
25 UIKit 0x18dd11c6c -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 240 (_UICanvasLifecycleMonitor.m:153)
26 UIKit 0x18dd10afc -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 724 (_UICanvasLifecycleMonitor.m:229)
27 UIKit 0x18e9a684c __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 296 (_UIApplicationCanvas.m:0)
28 UIKit 0x18dd101ec -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 432 (_UIApplicationCanvas.m:156)
29 UIKit 0x18e78bac8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220 (_UICanvasLifecycleSettingsDiffAction.m:211)
30 UIKit 0x18e8d9bf8 _performActionsWithDelayForTransitionContext + 112 (_UICanvasSettingsDiffAction.m:34)
31 UIKit 0x18dd0fc0c -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 248 (_UICanvasLifecycleSettingsDiffAction.m:182)
32 UIKit 0x18dd0f5a8 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 368 (_UICanvas.m:517)
33 UIKit 0x18dd0c5e0 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 540 (UIApplication.m:3109)
34 UIKit 0x18dd0c330 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 364 (UIApplicationSceneClientAgent.m:41)
35 FrontBoardServices 0x186938470 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 364 (FBSSceneImpl.m:460)
36 FrontBoardServices 0x186940d6c __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 224 (FBSWorkspace.m:606)
37 libdispatch.dylib 0x183a28a60 _dispatch_client_callout + 16 (object.m:507)
38 libdispatch.dylib 0x183a30170 _dispatch_block_invoke_direct$VARIANT$mp + 224 (queue.c:3018)
39 FrontBoardServices 0x18696c878 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36 (FBSSerialQueue.m:164)
40 FrontBoardServices 0x18696c51c -[FBSSerialQueue _performNext] + 404 (FBSSerialQueue.m:196)
41 FrontBoardServices 0x18696cab8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 (FBSSerialQueue.m:232)
42 CoreFoundation 0x1840df404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1982)
43 CoreFoundation 0x1840dec2c __CFRunLoopDoSources0 + 276 (CFRunLoop.c:2017)
44 CoreFoundation 0x1840dc79c __CFRunLoopRun + 1204 (CFRunLoop.c:2920)
45 CoreFoundation 0x183ffcda8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
46 GraphicsServices 0x185fe2020 GSEventRunModal + 100 (GSEvent.c:2245)
47 UIKit 0x18e01c758 UIApplicationMain + 236 (UIApplication.m:3965)
48 Visits 0x1007a589c main + 56 (Location+CoreDataClass.swift:15)
49 libdyld.dylib 0x183a8dfc0 start + 4
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000183bbd2e0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x0000000183d5e288 pthread_kill$VARIANT$mp + 376 (pthread.c:1484)
2 libsystem_c.dylib 0x0000000183b2bd0c abort + 140 (abort.c:91)
3 libc++abi.dylib 0x00000001832c72c8 abort_message + 132 (abort_message.cpp:75)
4 libc++abi.dylib 0x00000001832c7470 default_terminate_handler() + 304 (cxa_default_handlers.cpp:68)
5 libobjc.A.dylib 0x00000001832f08d4 _objc_terminate() + 124 (objc-exception.mm:657)
6 libc++abi.dylib 0x00000001832e137c std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:66)
7 libc++abi.dylib 0x00000001832e1400 std::terminate() + 84 (cxa_handlers.cpp:97)
8 libdispatch.dylib 0x0000000183a28a74 _dispatch_client_callout + 36 (object.m:510)
9 libdispatch.dylib 0x0000000183a30170 _dispatch_block_invoke_direct$VARIANT$mp + 224 (queue.c:3018)
10 FrontBoardServices 0x000000018696c878 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36 (FBSSerialQueue.m:164)
11 FrontBoardServices 0x000000018696c51c -[FBSSerialQueue _performNext] + 404 (FBSSerialQueue.m:196)
12 FrontBoardServices 0x000000018696cab8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 (FBSSerialQueue.m:232)
13 CoreFoundation 0x00000001840df404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1982)
14 CoreFoundation 0x00000001840dec2c __CFRunLoopDoSources0 + 276 (CFRunLoop.c:2017)
15 CoreFoundation 0x00000001840dc79c __CFRunLoopRun + 1204 (CFRunLoop.c:2920)
16 CoreFoundation 0x0000000183ffcda8 CFRunLoopRunSpecific + 552 (CFRunLoop.c:3245)
17 GraphicsServices 0x0000000185fe2020 GSEventRunModal + 100 (GSEvent.c:2245)
18 UIKit 0x000000018e01c758 UIApplicationMain + 236 (UIApplication.m:3965)
19 Visits 0x00000001007a589c main + 56 (Location+CoreDataClass.swift:15)
20 libdyld.dylib 0x0000000183a8dfc0 start + 4
Following is the code snippet where the program crashes. The crash happens at the self.view.layoutIfNeeded().
func initialSetupForScreen(){
let screenHeight = UIScreen.main.bounds.height
let statusBarHeight = UIApplication.shared.statusBarFrame.height
fullyOpenSheetTop = -(screenHeight - (statusBarHeight * 2))
partiallyOpenSheetTop = -((screenHeight * 0.50) - titleBarHeight)
closedSheetTop = -titleBarHeight
notVisibleSheetTop = 40 //(+40 for iphone X)
fullyOrPartiallyThreshold = (fullyOpenSheetTop + partiallyOpenSheetTop)/2
partiallyOrClosedThreshold = (partiallyOpenSheetTop + closedSheetTop)/2
// set primary & secondary sheet height //(+40 for iphone X) (-40 fixed for iphone X)
primarySheetViewHeightConstraint.constant = -fullyOpenSheetTop
secondarySheetViewHeightConstraint.constant = -fullyOpenSheetTop
// primary sheet is set to fully open state
primarySheetViewTopConstraint.constant = fullyOpenSheetTop
primarySheetCurrentState = .fullyOpen
// secondary sheet is set to not visible state
secondarySheetViewTopConstraint.constant = notVisibleSheetTop
secondarySheetCurrentState = .notVisible
// settings View move it out of screen
settingsViewTopConstraint.constant = notVisibleSheetTop
primarySheetController.configurePrimarySheetContentView()
self.view.layoutIfNeeded()
}
Earlier, I was calling this function inside my viewDidLoad. I thought it was too early to call layoutIfNeeded inside viewDidLoad. So I moved the function to viewWillAppear. However, the crashes still seem to be happening . What am I missing/overseeing?
The crash is happening across very few devices and I'm not able to reproduce it.
I got a few of these crashes (from Crashlytics), which I can't understand.
Anyone can understand what it is about?
I can see it happens after applicationDidEnterBackground. Does it mean it crashes after the app went into the background?
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x181b9db90 objc_msgSend + 16
1 CoreFoundation 0x1825314a4 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1548
2 CoreFoundation 0x182406788 _CFXNotificationPost + 368
3 Foundation 0x182e0e89c -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
4 UIKit 0x18791f124 __47-[UIApplication _applicationDidEnterBackground]_block_invoke + 320
5 UIKit 0x1879ef5e4 +[UIViewController _performWithoutDeferringTransitions:] + 128
6 UIKit 0x18791ef90 -[UIApplication _applicationDidEnterBackground] + 100
7 UIKit 0x18791f514 -[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:] + 700
8 UIKit 0x18792f990 -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 448
9 UIKit 0x18791961c __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 152
10 UIKit 0x1879192a4 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 712
11 FrontBoardServices 0x183ec77ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
12 FrontBoardServices 0x183ec7618 -[FBSSerialQueue _performNext] + 168
13 FrontBoardServices 0x183ec79c8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
14 CoreFoundation 0x1824dd124 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x1824dcbb8 __CFRunLoopDoSources0 + 540
16 CoreFoundation 0x1824da8b8 __CFRunLoopRun + 724
17 CoreFoundation 0x182404d10 CFRunLoopRunSpecific + 384
18 GraphicsServices 0x183cec088 GSEventRunModal + 180
19 UIKit 0x1876d9f70 UIApplicationMain + 204
20 Trenì€t! 0x1000f32e4 main (AppDelegate.swift:14)
21 libdispatch.dylib 0x181fa28b8 (Missing)