0
votes

I am trying to enable "Link All" in the Xamarin Forms Apps.It was successfully done in Android.But for , it's iOS version I am getting a run time error .

Application is just starting & getting crashed.

In iOSMain.csUIApplication.Main (args, null, "AppDelegate");

How can I resolve this ?

Crash logs attached.

Foundation.MonoTouchException has been thrown

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 0x000000010cf3c1bb exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010dec2735 objc_exception_throw + 48 2 CoreFoundation
0x000000010cf3bf42 +[NSException raise:format:arguments:] + 98 3
Foundation 0x000000010c0f5877 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194 4
UIKitCore 0x00000001162c217a -[UIApplication _runWithMainScene:transitionContext:completion:] + 2978 5 UIKitCore 0x0000000115ae04e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866 6 UIKitCore 0x0000000115ae929c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 7 UIKitCore 0x0000000115ae0126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233 8 UIKitCore 0x0000000115ae0ae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085 9 UIKitCore
0x0000000115adecb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795 10 UIKitCore 0x0000000115ade95f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435 11 UIKitCore 0x0000000115ae3a90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584 12 UIKitCore 0x0000000115ae480e _performActionsWithDelayForTransitionContext + 100 13 UIKitCore 0x0000000115ae37ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221 14 UIKitCore 0x0000000115ae893a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 15 UIKitCore 0x00000001162c044e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515 16 UIKitCore 0x0000000115e64d09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357 17 FrontBoardServices 0x00000001119552da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448 18 FrontBoardServices 0x0000000111960443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271 19 FrontBoardServices 0x000000011195fb3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53 20 libdispatch.dylib 0x000000010f3dc54b _dispatch_client_callout + 8 21 libdispatch.dylib 0x000000010f3df60b _dispatch_block_invoke_direct + 312 22 FrontBoardServices 0x0000000111994ba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK
+ 30 23 FrontBoardServices 0x0000000111994860 -[FBSSerialQueue _performNext] + 457 24 FrontBoardServices 0x0000000111994e40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 25 CoreFoundation 0x000000010cea1721 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 26 CoreFoundation 0x000000010cea0f93 __CFRunLoopDoSources0 + 243 27 CoreFoundation 0x000000010ce9b63f __CFRunLoopRun + 1263 28 CoreFoundation
0x000000010ce9ae11 CFRunLoopRunSpecific + 625 29 GraphicsServices
0x0000000111bb91dd GSEventRunModal + 62 30 UIKitCore
0x00000001162c381d UIApplicationMain + 140 31 ???
0x000000012cb7629e 0x0 + 5045183134 32 ???
0x000000012cb76033 0x0 + 5045182515

1
Are you assigning any Root view controller from your AppDelegate? Or If your Xamarin Forms App does initializing any MainPage? Can you initialize the Empty view controller from your AppDelegate and later open the Xamarin Forms App? Can you open any other page than your current page you are opening from your AppDelegate/Xamarin Forms App? These are all the possibilities you may want to test before.Nirmal Subedi
@NirmalSubediI will try all these & will let you knowDon Chakkappan
Try to link Use SDK assemblies Only from the option it should work.Adit Kothari

1 Answers

1
votes

I am using Link all assemblies instead of Link SDK assemblies only to reduce APK/IPA file size.

It reduces ~20MB for both iOS & Android.

For iOS I have to add [Preserve(AllMembers = true)] in all dependency service implementation. Now everything works fine.