iOS app crashing on startup when there is no network connection - ios

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.

Related

A iOS crash that doesn't have enough clue to fix. SIGSEGV crash at _objc_msgSend

I met a crash and I have no idea how to solve it. It is a SIGSEGV crash, and here is the last code stack:
0
libobjc.A.dylib
_objc_msgSend + 44
1
CoreFoundation
-[__NSSetI containsObject:] + 156
2
UIKitCore
-[UIInputResponderController _reloadInputViewsForKeyWindowSceneResponder:] + 3532
3
UIKitCore
-[UIInputResponderController _reloadInputViewsForResponder:] + 160
4
UIKitCore
-[UIInputResponderController forceReloadInputViews] + 220
5
UIKitCore
___43-[_UIRemoteKeyboards reloadForSnapshotting]_block_invoke + 148
6
UIKitCore
+[UIInputResponderController performOnControllers:] + 476
7
UIKitCore
-[_UIRemoteKeyboards setIsSnapshotting:] + 108
8
UIKitCore
-[UITextEffectsWindow _willSnapshot] + 124
9
UIKitCore
-[UIApplication _beginSnapshotSessionForScene:withSnapshotBlock:] + 776
10
UIKitCore
___65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke + 132
11
UIKitCore
-[UIScene _enableOverrideSettingsForActions:] + 60
12
UIKitCore
-[UIScene _performSystemSnapshotWithActions:] + 120
13
UIKitCore
-[UIApplication _performSnapshotsWithAction:forScene:completion:] + 440
14
UIKitCore
___98-[_UISceneSnapshotBSActionsHandler _respondToActions:forFBSScene:inUIScene:fromTransitionContext:]_block_invoke_3 + 168
15
UIKitCore
___98-[_UISceneSnapshotBSActionsHandler _respondToActions:forFBSScene:inUIScene:fromTransitionContext:]_block_invoke_2 + 468
16
UIKitCore
-[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 664
17
UIKitCore
-[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 220
18
UIKitCore
-[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 464
19
FrontBoardServices
-[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 456
20
FrontBoardServices
___94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 124
21
FrontBoardServices
-[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232
22
FrontBoardServices
___94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 368
23
libdispatch.dylib
__dispatch_client_callout + 16
24
libdispatch.dylib
__dispatch_block_invoke_direct$VARIANT$mp + 224
25
FrontBoardServices
___FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40
26
FrontBoardServices
-[FBSSerialQueue _targetQueue_performNextIfPossible] + 404
27
FrontBoardServices
-[FBSSerialQueue _performNextFromRunLoopSource] + 28
28
CoreFoundation
___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
29
CoreFoundation
___CFRunLoopDoSource0 + 204
30
CoreFoundation
___CFRunLoopDoSources0 + 356
31
CoreFoundation
___CFRunLoopRun + 776
32
CoreFoundation
_CFRunLoopRunSpecific + 572
33
GraphicsServices
_GSEventRunModal + 160
34
UIKitCore
-[UIApplication _run] + 1052
35
UIKitCore
_UIApplicationMain + 164
36
LetvIphoneClient
main (main.m:29)
37
libdyld.dylib
_start + 4
Other information:
this crash mostly appear at the launching of the App.
read the code stack, the crash probably takes place when user's keyboard is using.
I can't solve this crash because I don't have enough clues and the code stack doesn't have any my App code, only system code.
Any clue about this crash is appreciate. Thank you.
What's interesting thing is, this crash takes place on time everyday, just 5pm to 8pm(Beijing time). We can not see any one crash takes place at other time in a day. A weird crash!

Symbolicated Crash Log: Is this How I Follow Offsets?

I'm very new to the App Store Validation process, and I'm getting a crashes in their testing that do not happen in Simulators or real device testing. This seems to be common story.
Here's the relevant part of the latest crash log from Apple:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 WordsBy2 0x0000000102f757b0 0x102f68000 + 55216
1 WordsBy2 0x0000000102f75698 0x102f68000 + 54936
2 WordsBy2 0x0000000102f79cbc 0x102f68000 + 72892
3 WordsBy2 0x0000000102f753fc 0x102f68000 + 54268
4 UIKitCore 0x0000000182eeb35c -[UIClassSwapper initWithCoder:] + 2196
5 UIFoundation 0x0000000189618edc UINibDecoderDecodeObjectForValue + 696
6 UIFoundation 0x00000001895a5854 -[UINibDecoder decodeObjectForKey:] + 308
7 UIKitCore 0x0000000182eef544 -[UIRuntimeConnection initWithCoder:] + 128
8 UIFoundation 0x0000000189618edc UINibDecoderDecodeObjectForValue + 696
9 UIFoundation 0x00000001896190f4 UINibDecoderDecodeObjectForValue + 1232
10 UIFoundation 0x00000001895a5854 -[UINibDecoder decodeObjectForKey:] + 308
11 UIKitCore 0x0000000182eea4fc -[NSCoder+ 7791868 (UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 488
12 UIKitCore 0x0000000182eeced4 -[UINib instantiateWithOwner:options:] + 1064
13 UIKitCore 0x000000018341c948 -[UIStoryboard __reallyInstantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 280
14 UIKitCore 0x000000018341c7e4 -[UIStoryboard _instantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 124
15 UIKitCore 0x000000018350c704 -[UIWindowScene _loadWindowWithStoryboardIfNeeded:] + 96
16 UIKitCore 0x000000018350c670 -[UIWindowScene _readySceneForConnection] + 148
17 UIKitCore 0x00000001827c69d0 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1012
18 UIKitCore 0x00000001832abca0 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1032
19 UIKitCore 0x00000001832ac044 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 328
20 UIKitCore 0x0000000182debab8 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 360
21 FrontBoardServices 0x000000018fd69704 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 404
22 FrontBoardServices 0x000000018fd91130 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 100
23 FrontBoardServices 0x000000018fd76e60 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232
24 FrontBoardServices 0x000000018fd90e44 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 312
25 libdispatch.dylib 0x0000000180678280 _dispatch_client_callout + 16
26 libdispatch.dylib 0x000000018061d930 _dispatch_block_invoke_direct$VARIANT$mp + 224
27 FrontBoardServices 0x000000018fdb5e60 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40
28 FrontBoardServices 0x000000018fdb5b28 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 404
29 FrontBoardServices 0x000000018fdb5ffc -[FBSSerialQueue _performNextFromRunLoopSource] + 28
30 CoreFoundation 0x00000001809bfbf0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
31 CoreFoundation 0x00000001809bfaf0 __CFRunLoopDoSource0 + 204
32 CoreFoundation 0x00000001809bee38 __CFRunLoopDoSources0 + 256
33 CoreFoundation 0x00000001809b93e0 __CFRunLoopRun + 776
34 CoreFoundation 0x00000001809b8ba0 CFRunLoopRunSpecific + 572
35 GraphicsServices 0x0000000197721598 GSEventRunModal + 160
36 UIKitCore 0x00000001832aa2f4 -[UIApplication _run] + 1052
37 UIKitCore 0x00000001832af874 UIApplicationMain + 164
38 libswiftUIKit.dylib 0x0000000194139b54 UIApplicationMain+ 80724 (_:_:_:_:) + 100
39 WordsBy2 0x0000000102f6c9ec 0x102f68000 + 18924
40 libdyld.dylib 0x0000000180697568 start + 4
This a fairly simple question, but I want to be sure... the last line corresponds to the start() method in my initialization process, and I presume the the + 4 is the fourth line of code in that code block? And I also presume that that includes commented lines in my original code?
If so, and that line sets a property of an optional instantiated class, then I assume a crash at this line would indicate that there was a problem with that object, but that the object would not appear in the crash log, since it wasn't one of its methods that was called. Correct?

The service configuration is `nil`. You need to configure `Info.plist` or set `defaultServiceConfiguration` before using this method

I'm trying to connect an existing AppSync API to my iOS app.
To perform this, I followed the instructions on this page: https://docs.amplify.aws/cli/graphql-transformer/codegen#ios-usage, but instead of performing:
amplify add api
amplify push
I added my existing AppSync API:
amplify add codegen --apiId XXXXXXXXXXXXXXX
amplify codegen
After running those commands, I added awsconfiguration.json and API.swift to my project.
After performing the setup, I initialized the AppSync client in the AppDelegate file:
import AWSAppSync
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var appSyncClient: AWSAppSyncClient?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
do {
// You can choose your database location if you wish, or use the default
let cacheConfiguration = try AWSAppSyncCacheConfiguration()
// AppSync configuration & client initialization
let appSyncConfig = try AWSAppSyncClientConfiguration(appSyncServiceConfig: AWSAppSyncServiceConfig(), cacheConfiguration: cacheConfiguration)
appSyncClient = try AWSAppSyncClient(appSyncConfig: appSyncConfig)
} catch {
print("Error initializing appsync client. \(error)")
}
}
}
It's worth mentioning that I'm using AWS SDK (for DynamoDB using Object Mapper) in my app (the previous SDK, not Amplify yet)
The problem is that when I'm running the app, it immediately crashes.
This is the log message that comes along with the crash:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The service configuration is `nil`. You need to configure `Info.plist` or set `defaultServiceConfiguration` before using this method.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 AWSDynamoDB 0x000000010be77baa __54+[AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper]_block_invoke + 474
3 libdispatch.dylib 0x000000010cb04d48 _dispatch_client_callout + 8
4 libdispatch.dylib 0x000000010cb06297 _dispatch_once_callout + 66
5 AWSDynamoDB 0x000000010be779a4 +[AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper] + 84
6 App 0x000000010a7d0f9c $s22App10GlobalVarsCACycfc + 140
7 App 0x000000010a7ca97c $s22App10GlobalVarsCACycfC + 60
8 App 0x000000010a7fd7e1 $s22App21LoadingViewControllerC5coderACSgSo7NSCoderC_tcfc + 113
9 App 0x000000010a7fd943 $s22App21LoadingViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 51
10 UIKitCore 0x00007fff47cf7268 -[UIClassSwapper initWithCoder:] + 2427
11 UIFoundation 0x00007fff4753d872 UINibDecoderDecodeObjectForValue + 744
12 UIFoundation 0x00007fff4753db19 UINibDecoderDecodeObjectForValue + 1423
13 UIFoundation 0x00007fff4753d57d -[UINibDecoder decodeObjectForKey:] + 251
14 UIKitCore 0x00007fff47cf6531 -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsAndTrackChildViewControllerIndexWithParent:forKey:] + 298
15 UIKitCore 0x00007fff47a0e65d -[UIViewController initWithCoder:] + 1419
16 UIKitCore 0x00007fff4795cc16 -[UINavigationController initWithCoder:] + 65
17 UIKitCore 0x00007fff47cf7268 -[UIClassSwapper initWithCoder:] + 2427
18 UIFoundation 0x00007fff4753d872 UINibDecoderDecodeObjectForValue + 744
19 UIFoundation 0x00007fff4753d57d -[UINibDecoder decodeObjectForKey:] + 251
20 UIKitCore 0x00007fff47cfb56f -[UIRuntimeConnection initWithCoder:] + 125
21 UIFoundation 0x00007fff4753d872 UINibDecoderDecodeObjectForValue + 744
22 UIFoundation 0x00007fff4753db19 UINibDecoderDecodeObjectForValue + 1423
23 UIFoundation 0x00007fff4753d57d -[UINibDecoder decodeObjectForKey:] + 251
24 UIKitCore 0x00007fff47cf6336 -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 450
25 UIKitCore 0x00007fff47cf90a5 -[UINib instantiateWithOwner:options:] + 1145
26 UIKitCore 0x00007fff481f8f24 -[UIStoryboard __reallyInstantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 279
27 UIKitCore 0x00007fff481f8dcf -[UIStoryboard _instantiateViewControllerWithIdentifier:creator:storyboardSegueTemplate:sender:] + 97
28 UIKitCore 0x00007fff48091ebf -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 167
29 UIKitCore 0x00007fff48092473 -[UIApplication _loadMainInterfaceFile] + 274
30 UIKitCore 0x00007fff48090dff -[UIApplication _runWithMainScene:transitionContext:completion:] + 964
31 UIKitCore 0x00007fff477c576d -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
32 UIKitCore 0x00007fff47cb44c1 _UIScenePerformActionsWithLifecycleActionMask + 83
33 UIKitCore 0x00007fff477c627f __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
34 UIKitCore 0x00007fff477c5c8e -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 296
35 UIKitCore 0x00007fff477c60ac -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 818
36 UIKitCore 0x00007fff477c5941 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
37 UIKitCore 0x00007fff477c9f3f __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 178
38 UIKitCore 0x00007fff47bd8c83 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 865
39 UIKitCore 0x00007fff47cd2dff _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240
40 UIKitCore 0x00007fff477c9c5a __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 153
41 UIKitCore 0x00007fff47cd2d02 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84
42 UIKitCore 0x00007fff477c9ac8 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 381
43 UIKitCore 0x00007fff476206e7 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 657
44 UIKitCore 0x00007fff4761f26c -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248
45 UIKitCore 0x00007fff47620411 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 210
46 UIKitCore 0x00007fff4808f599 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 535
47 UIKitCore 0x00007fff47bfa7f5 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
48 FrontBoardServices 0x00007fff365d6165 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 442
49 FrontBoardServices 0x00007fff365fc4d8 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
50 FrontBoardServices 0x00007fff365e0c45 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
51 FrontBoardServices 0x00007fff365fc169 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
52 libdispatch.dylib 0x000000010cb04d48 _dispatch_client_callout + 8
53 libdispatch.dylib 0x000000010cb07cb9 _dispatch_block_invoke_direct + 300
54 FrontBoardServices 0x00007fff3662237e __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
55 FrontBoardServices 0x00007fff3662206c -[FBSSerialQueue _queue_performNextIfPossible] + 441
56 FrontBoardServices 0x00007fff3662257b -[FBSSerialQueue _performNextFromRunLoopSource] + 22
57 CoreFoundation 0x00007fff23bd4471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
58 CoreFoundation 0x00007fff23bd439c __CFRunLoopDoSource0 + 76
59 CoreFoundation 0x00007fff23bd3b74 __CFRunLoopDoSources0 + 180
60 CoreFoundation 0x00007fff23bce87f __CFRunLoopRun + 1263
61 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
62 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
63 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
64 App 0x000000010a841728 main + 72
65 libdyld.dylib 0x00007fff5227ec25 start + 1
66 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Apparently, because I'm using the old version of AWS SDK for iOS, I couldn't use both awsconfiguration.json file and the AWS section in Info.plist file.
In order to solve it, I removed the awsconfiguration.json file from Build Phases -> Copy Bundle Resources, and added the AppSync API details from that file to the Info.plist file:
<key>AWS</key>
<dict>
<key>AppSync</key>
<dict>
<key>Default</key>
<dict>
<key>ApiUrl</key>
<string>https://XXXXXXXXXXXXX.appsync-api.xx-xxxx-x.amazonaws.com/graphql</string>
<key>Region</key>
<string>xx-xxxx-x</string>
<key>AuthMode</key>
<string>API_KEY</string>
<key>ApiKey</key>
<string>XXXXXXXXXXXXX</string>
<key>ClientDatabasePrefix</key>
<string>XXXXXXXX_API_KEY
</dict>
</dict>
...
</dict>

Get "'Can't modify a named fetch request in an immutable model" using nspredicate

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)

Xamarin.Forms Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException

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.

Resources