3 Replies
      Latest reply on Oct 5, 2019 8:43 PM by edxsturt
      edxsturt Level 1 Level 1 (0 points)

        We submitted this question earlier and we do not see it listed.


        Scenario:  legacy code in Objective-C (works in Xcode 8 and 9) has storyboard entry point to LaunchViewController.  When debug trace in Xcode 11, it always goes to AppDelegate.m -> didFinishLaunchingWithOptions, instead of viewDidLoad of LaunchViewController as expected.


        "is Initial View Controller" is enabled with LaunchViewController.m.


        How do we get Xcode 11 to recognize LaunchViewController as the entry point in Xcode 11?


        Thank you.

        • Re: Storyboard entry point does not work for legacy code in Xcode 11
          junkpile Level 6 Level 6 (2,485 points)

          I don't think it has ever been safe to assume that any other code would get executed before didFinishLaunchingWithOptions. Important initialization should normally be done in the app delegate.

          • Re: Storyboard entry point does not work for legacy code in Xcode 11
            Claude31 Level 8 Level 8 (7,825 points)

            I replied in the other thread you posted: https://forums.developer.apple.com/thread/123875

            • Re: Storyboard entry point does not work for legacy code in Xcode 11
              edxsturt Level 1 Level 1 (0 points)

              Workflow scenario:  LaunchViewController.m decides if (fresh installation of app) AuthenticationViewController needs to appear or the Main Display window (after authentication) should appear.


              This has been working fine for Xcode 8 and 9.  With Xcode 11, AppDelegate.m's didFinishLaunchingWithOptions appears first, which is manageable.


              But then because LaunchViewController has the storyboard entry point, its viewDidLoad would appear after didFinishLaunchingWithOptions

              and that disrupts the workflow.  Since it would decide whether to call AuthenticationViewController, we end up with this error:


              Attempt to present <AuthenticationViewController: 0x> on <LaunchViewController: 0x> whose view is not in the window hierarchy!


              No other view controller can be the initial view controller but the LaunchViewController but since it would appear right after AppDelegate's didFinishLaunchingWithOptions, it disrupts the workflow.


              loadStoryBoard method of AppDelegate.m is not triggered at all in Xcode 8, 9, or 11.  Ideally if we can have LaunchViewController's didViewLoad be called first to handle authentication or not (before AppDelegate), then the app will work with iOS 13 simulator, the purpose of this coding change.


              Thank you.