1 Reply
      Latest reply on Oct 12, 2019 3:15 AM by Claude31
      flarosa Level 1 Level 1 (0 points)

        I've been using this code to create simple apps for years, but it is suddenly not working anymore with iOS 13 and Xcode 11. When I run the app I just get a blank screen. What am I doing wrong?

         

          var window: UIWindow?
        
          func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
          {
          window = UIWindow(frame: UIScreen.main.bounds)
          window?.rootViewController = UINavigationController(rootViewController: HomeViewController())
          window?.makeKeyAndVisible()
          return true
          }
        
        
        • Re: makeKeyAndVisible doesn't work?
          Claude31 Level 8 Level 8 (6,555 points)

          Have you checked if you have a sceneDelegate file ?

          If so, you need to add an entry in your infos.plist:

           

          <?xml version="1.0" encoding="UTF-8"?>

          <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

          <plist version="1.0">

          <dict>

              <key>UIApplicationSupportsMultipleScenes</key>

              <false/>

              <key>UISceneConfigurations</key>

              <dict>

                  <key>UIWindowSceneSessionRoleApplication</key>

                  <array>

                      <dict>

                          <key>UISceneConfigurationName</key>

                          <string>Default Configuration</string>

                          <key>UISceneDelegateClassName</key>

                          <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>

                          <key>UISceneStoryboardFile</key>

                          <string>Main</string>

                      </dict>

                  </array>

              </dict>

          </dict>

          </plist>

           

           

          Why do you need to create the window ?

           

          In my apps, view is created in IB and I do not need to call window nor set it key and visible.