0
votes

I am trying to reorganize an old application written in Xamarin. The application gives the following error without opening the application in the simulator. Can you help me?

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 0x00007fff20421af6 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff20177e78 objc_exception_throw + 48 2 CoreFoundation 0x00007fff2042191f +[NSException raise:format:] + 0 3 Foundation 0x00007fff2077156a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4 UIKitCore 0x00007fff2469a8fc -[UIApplication _runWithMainScene:transitionContext:completion:] + 2148 5 UIKitCore 0x00007fff23cc36f7 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122 6 UIKitCore 0x00007fff24251d1e _UIScenePerformActionsWithLifecycleActionMask + 88 7 UIKitCore 0x00007fff23cc4206 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198 8 UIKitCore 0x00007fff23cc3cca -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 474 ...... enter image description here

1
Do you develop the app in xamarin.forms or xamarin.ios?Steven-MSFT
Please dont create code images. Its a violation of SO guidelines. You can easily write your code in SO with markdown.Muhammad Tariq
xamarin.ios developgkn

1 Answers

0
votes

iOS9 requires all the Window must have a rootViewController, you should edit AppDelegate like this:

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            var indexVC = new IndexViewController ();
            window = new UIWindow ((CGRect)UIScreen.MainScreen.Bounds);
            window.RootViewController = indexVC;
            window.MakeKeyAndVisible ();


            return true;
        }

you can refer to this page for more details.

There are some changes since ios9, you can refer to this and this page