Objective C App has wrong [UIScreen mainScreen].bounds value since iOS 16 - ios

Device: Physical iPhone X (16.0.2)
A legacy app (Objective C) of my client has worked just fine on iOS 15. On iOS 16 though, the app has suddenly 'shrunken in height'. The app opens as usual but on the top and bottom of the screen, there are black bars, as the app itself seems to be constrained to a certain size.
After some investigation, I found out that the device actually reports its Screen Height to be 480pt (iPhone X). Forcing the UIWindow to have a different size doesn't solve the issue, the app is still constrained to be the same wrong height. It seems the device 'actually believes' to be shorter than it is.
Since this behavior kind of resembles what happens when starting an iPhone app on an iPad (at least I remember seeing something like that some time ago), I was wondering whether or not this behavior is expected as of iOS 16?
If not, I would really appreciate some help here.
EDIT: I learned that +[UIScreen mainScreen] is deprecated as of iOS 16 so using that to initialize the window might be the issue. Though there seems to be no alternative for accessing this info all the way back in the AppDelegate. It was suggested to use self.view.window.windowScene.screen for reading a device's screen size, but sadly this is not accessible in the AppDelegate.

WORKAROUND:
I was not able to find the root cause of the issue but could resolve it by using storyboards to load the initial ViewController. This caused the system to automatically create a window, which was not affected by this weird system behavior.

Related

iPhone app is running at iPhone 4 size with black bars after update

Previously the app supported the iPhone 5s/SE screen and iPhone 6-8 screens (not the plus sizes), this was done using launch images. So on Plus sized devices and iPhone X* devices it would display black bars above and below the app.
We then released an update where among other things a launch storyboard was added. All through the development of this update the screen size worked perfectly on every device we had. However after releasing the update on the App Store, for some users, the app now shows at iPhone 4 size (height/width ratio is 1.5). So now affected users on an SE have the black bars, and X* users have bigger black bars the before. This doesn't seem to affect everyone, and we can't replicate on our devices.
The deployment target is 10, so there should be no reason to use the old launch images method. And the update is definitely using a storyboard for the launch screens.
Has a similar thing happened to anyone else? Or is there something you have to do specially when releasing an update that moves to the storyboard method from individual launch images?
All the existing answers either say to make sure you have the correct screenshots, or use a xib/storyboard. We don't have any screenshots and are definitely using a storyboard.
EDIT: now after a few hours of restarting the app users are starting to see the correct sizes, implying it’s an iOS caching issue.
I have experienced it lot before.
Reason: iOS commonly keeps launch screens of all apps in its own cache system, So, unless your app get loaded,it can show that launch images/screen to user from cache. Now, As your app was previously having launch images and now moved to storyboard, it makes this problem.
Also note that, iOS always render your app in screensize which it have in launchscreen, thats why you are seeing black bars at top and bottom.
Way to reproduce: This will happen everytime you update your launch screen. Try adding some label or some other component to your launchscreen.storyboard and install it. You will not see updated launch screen for some duration.
Best Solution(It works almost for all): Just update your app's version number and install on the device. After version number get updated, it will take new updated resources.
If above solution didn't worked for you, then you can try for these alternate solutions:
Solution 01: Your user might have to delete older app and install new one
Solution 02: Your user needed to reboot their device after update.
Solution 03: iOS System itself refreshes its own cache after certain interval, so your customers might face issue just after updating... but will get resolved automatically after some duration(around 3-4 hours).
I experienced similar issues with LaunchScreen Storyboard changes and when switching from Launch Images. It is an iOS Bug, sometimes you need to reboot the device in order to see the correct LaunchScreen when changes are made, it is very odd and difficult to reproduce.
Most probably there is nothing wrong with your App...
Yes Jonathan, it has happened to others as well.
Sadly it seems that this is a real iOS issue, the problem is real (those negationists please believe).
I called the Apple Support and the developer/support staff that I talked with, seemed aware and/or heard the issue, although the response was unclear I did, nonetheless, report the issue properly. "They will check it out". Typical Apple sideways answer...
Now, current solutions:
It seems that what has worked is the On/off iPhone solution, drastic and heavily inconvenient but currently it's the only workaround "tested".
I am deeply sorry for not solving you inquire straight, but I think this affair is beyond any of us developers field of action, it seems (yet to confirm) an OS problem, which Apple and only Apple can fix for real.

iPhone X scaling issue, can we scale existing apps to fullscreen mode without an app update

All my existing apps are not scaled to iPhone X, is there any way to make them to full screen without an update.
It will be really helpful if we don't have to go to the hassle of upgrading all the apps again.
And if not what are the options of doing it.
It is reminding me of days back to iPhone 6.
No, you can’t get your app out of letterboxed mode without at the very least updating your app to use a launch storyboard (and building it against the iOS 11 SDK).
Also, just doing that might not make your app work right on iPhone X — unless all your UI is built from only basic uses of system view controllers, you’re likely to have at least a few issues where you need to tweak your layout to respect safe areas. (Otherwise you end up with UI hiding under the notch or rounded corners.)

Magnified UI for the whole ios app

I dont quite remember what change I made but the whole UI seemed to be magnified for my ios app including font sizes , image sizes. Strange thing is the time , battery power ad network connection symbols which are usually shown on top have also magnified. I cant seem to figure out why . Can someone please advise ?
I have already tried playing with size classes ( with / without for each VC ) and it dint work
It may be running in the 4" compatibility mode, which was to allow older apps to run on the newer 6 and 6+ phones full screen. you might need to change your splash screen of you app to have all the sizes to fix this, if you dont have it already

iOS Universal app seems slightly zoomed in on phone

I have an iPad app that I'm converting to a universal app to show on phones. It has both a tab bar and a navigation bar, and my problem is that they are both way too big on the phone. I could swear I heard Paul Hegarty (from the iTunes U class from Stanford on Swift app development) mention a switch or trick somewhere that would cause the bars to adapt to the iPhone, but I can't find it.
Here are screenshots of my apps bars, vs the Photos app in the iPhone 6 simulator to show what I'm talking about.
Not a huge difference, but significant on a small phone screen.
My fonts are also way to big, which is confusing since I have them set to the system "headline" or "body" options for all size classes, but that may be a separate issue.
Any help is greatly appreciated!
App written in Swift, using storyboards for iOS8, btw.
Edit:
The more I look at this, the more I'm convinced it's not related to the bars, but the entire app - the fonts and everything. The whole app appears to be zoomed in to 120%, which is subtle, but looks really bad and wastes space.
I have also now seen this in a second app - the Apple DateCell sample. It also appears 'zoomed in' when run on the iPhone 6 simulator.
Edit 2:
This effect is even more exaggerated on the iPhone 6 Plus simulator - everything is even more 'zoomed in' looking - the top and bottom bars are almost twice the height they should be. This can be seen by downloading the Apple DateCell sample and running it.
Edit 3:
ARGGGG, all this time wasted, and it was due to the launch screen image - why on earth would a launch screen image not being set cause the entire app to scale?
I finally figured this out - it was related to the launch screen image. Apparently if it's not setup right, the whole app scales on the iPhone 6 and 6 Plus for some reason. This question is what pointed me to the answer.
For me, I had to both create a LaunchScreen image in Assets, and set it in the project file, and ALSO select the launchScreen.xib as the Launch Screen File in the project. I don't have a real launch screen yet, so these are both just empty or defaults in my case.

Application's view differs in ios 5 compared to ios 4

I have developed a ebook reder which supports ios 3.2 and above versions of ipad.The ebook reader shows a single page in portrait mode and 2 pages in landscape mode. The application works fine on ios 4.3.
I tried the same application on another device which runs on ios 5, the application works fine until i change the orientation.Once the orientation is changed the view sizes are not proper and it seems like it is taking portrait view size in landscape and vice versa.
what is the difference with ios 4 and ios 5 regarding orientation changes ,etc.
I searched on internet but could not find the exact reason or solution.One of the stack overflow search was describing the container view concept in ios 5, but it is not sufficient for me.
Can someone help me in resolving my issue.
Thank you
Not sure how helpful this is but it has caused some troubles for me. iOS5 has improved the forwarding of messages to child views and viewControllers. Things like viewDidAppear, viewDidDissappear, rotation notices, etc. The problem is that since these were not reliably forwarded in earlier versions things you may have done to compensate for that short coming may mean that now those functions are getting called twice. Not sure if that's your issue but it could be.

Resources