0

Context: I have inherited a legacy app still running in Swift 3, part of the AppDelegate looks like this:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // ...some other code here

        window = UIWindow(frame: UIScreen.main.bounds)

        // ...even more other code here

        print(window?.frame, UIScreen.main.bounds)
        return true
    }

Regardless of the device used - from iPhone 5S to iPad Pro (3rd gen) - the output is always the following:

Optional((0.0, 0.0, 320.0, 568.0)) (0.0, 0.0, 320.0, 568.0)

Does anyone have any idea as to why such a thing might happen?

Update

Further investigation has revealed that neither the LaunchImages nor LaunchScreen.storyboard are to blame, but instead a directory of pngs that essentially override LaunchScreen.storyboard somehow. The app's UIWindow bound is taken from the dimensions of these pngs somehow!!! I am continuing to investigate further, but if anyone has any ideas in the meanwhile I would be grateful, thank you.

matt
  • 515,959
  • 87
  • 875
  • 1,141
Joseph Beuys' Mum
  • 2,395
  • 2
  • 24
  • 50
  • 1
    Possible duplicate of [App not sized properly iOS 8 iPhone simulator](https://stackoverflow.com/questions/26043494/app-not-sized-properly-ios-8-iphone-simulator) – Wolfgang Apr 23 '19 at 15:01
  • 1
    Your app doesn't have a launch screen. – rmaddy Apr 23 '19 at 15:20
  • Thanks all, am investigating... – Joseph Beuys' Mum Apr 25 '19 at 09:43
  • Thanks @Wolfgang. I have updated the LaunchImage dir. but that hasn't changed anything – Joseph Beuys' Mum Apr 25 '19 at 10:48
  • @rmaddy interestingly (in a boring kind of way) there is a LaunchScreen.storyboard, but the graphics in the launch screen the app is actually using are nothing like those in the storyboard, and updating the storyboard does nothing to change them. – Joseph Beuys' Mum Apr 25 '19 at 10:49
  • @rmaddy whilst there was a LaunchScreen.storyboard it wasn't linked to in the General tab of the project. If you want to add that as an answer I'd be happy to accept – Joseph Beuys' Mum Apr 25 '19 at 12:29
  • @JosephBeuys'Mum The update your put in your question should be removed and posted as an answer below. You found the problem. It's fine for you to post your own answer. – rmaddy Apr 25 '19 at 15:35
  • @rmaddy I found something that helped, but unless I understand how and/or why Xcode was using these PNGs I can't justify calling it an answer, and I don't have the time to investigate further – Joseph Beuys' Mum Apr 30 '19 at 12:46

0 Answers0