How to debug layout constraint issues in iOS? - ios

I'm unable to build an interface I want to build as the objects does not obey the constraints I place on them.
Clarification to this who do not understand the question above:
I want what I see in Xcode on all devices, no matter the constraints on a iPhone 7+ and I assume a 7 and lower the image is either stretched or reshaped.
iphoneX simulator renders correctly
iPhone 7+ with same constraints
Xcode:
Build:

So this is the answer as it's only affecting me currently. It's been escalated to Code-Level Support, They are sending someone to the team to investigate my mac as even when reinstalling Xcode it should not have or build the problem above. If anyone else is having the trouble above they should use a code-level support request as this is on their end as far as we know about.

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.

Ignoring warnings in Xcode 6

I'm a beginner iOS programmer and I guess this is a newbie question.
Are you allowed to ignore warnings when placing views in storyboard if the autolayout is working as expected - warnings like misplaced view or ambiguous height?
Is the app going to work even if I don't fix the warnings and will that app be published?
It seems that the layout may get distorted on some devices if the warnings are ignored. The display of the simulator is not accurate and the app must be tested on actual devices.
All credits for the answer go to Raptor for answering in the comments.

iOS app layout in the simulator different than on the actual device

My app looks completely different on a real device compared to a simulator. I used storyboard and used "add missing constraints" on all objects to remove warnings. Could this have caused the problem?
The actual device has most image views collapsed in the upper left corner
The simulator (for all devices you can test with) shows all 4 images filling the screen
Thanks!
A likely cause would be Autolayout constraints that do not create the intended effect.
You may be seeing the expected behaviour in the simulator simply because it has old cached versions of the NIB files... sometimes will get device/simulator differences due to this. Alternatively, could be the app on the device that has the old version. A clean build may result in problem resolved or seeing the same problem in both places, either of which solves half the question.
Using the automatic "Add missing constraints" is almost certainly the immediate cause here, if the problem occurred at the same time you did that.
Presuming you have the project under source control, I'd recommend rolling back and adding missing constraints in a more planned way, as the automatic system isn't smart enough for every scenario it seems.

Black Frame Around iPad Build

I made an iPhone app under universal applications. Deleted the iPad storyboard at the start and added it back in using this answer: Converting Storyboard from iPhone to iPad at a later stage.
Now when I run my iPad build, there seems to be a black border around it.
I've made sure my .plist is using Main_iPad for Main storyboard file base name (iPad).
Found my bug: this is because under Deployment Info in the General tab, I selected only iPhone as my Devices. Changing it to Universal fixed it.
Frankly speaking, this looks like just a scaled-up version of iPhone app. Anyways, to make it work in a better shape you may have to tweak here :
Make sure you have added constraints that actually meeting the iPad size requirements as well. The width & the Heights.
Please provide a launchImage for iPad size. That should solve your problem.
Hope that helps.

iOS - iPad layout top/botton spacing doesn't seem to do what I tell it to do

I am creating this screen:
But when I run things, I get it to look like this.
If you notice, the space below/above some elements looks off. Would anyone know why thing happens and how to fix this?
Thank you!
If you're asking about why the buttons look the way they do, that is because your storyboard is set to be viewed as "iOS 6.1 and Earlier", so you're seeing the interface elements as the appear under iOS 6.1 -. Then when you run the application on your iOS 7 simulator, these same elements appear as they do in iOS 7 +, which you can see is quite different.
Then as far as the alignment problems go, I suggest you read through the 80 iPad storyboard related warnings that Xcode is generating and fix your constraints.

Resources