I started a new single view project on Xcode 6.1
went to my target and set Device Family to Universal and Deployment target to 7.1
In the storyboard i placed a red label in Size class Regular Width | Any Height
and a blue label in Size Class Compact Width | Any Height
According to documentation i should see a red label when running on ipad and blue on iphone, So far this is working as expected in both simulator and on actual devices.
Now i went back to the target and set Device Family to IPad, Running the application again:
IPad 2 (7.1) on simulator - red label
IPad 2 (7.1) (real device) - blue label ?!?!?
IPad 2 (8.1) (real device) - red label
The same goes for IPad Air/ IPad mini and every other IPad with IOS 7.1 i came across
Basically i am seeing that on universal storyboard, when setting device family for IPad in ios 7.1 the storyboard is considered to be compact size. I must be compatible with IOS 7.1 and my application will be released only for IPad at first. Does anyone have a clue how to fix it ?
Edit
According to Apple Documentation: For apps supporting versions of iOS earlier than iOS 8, most size classes are backward compatible. Size classes are backward compatible as long as
The app is built using Xcode version 6 or later
The deployment target of the app is earlier than iOS 8
Size classes are specified in a storyboard or xib
The value of the height component is not compact
All of the above applies for my example.
SIMULATOR VS. DEVICE? I have been able to reproduce the problem that you report in the simulator.
I think you are assuming that your Simulator is working correctly, because it is resulting in the output you expect, and it is the iPad that is displaying the 'wrong' layout. However, it is worth considering whether the iPad is actually displaying the standard output for your configuration, even if that output represents a bug. The Storyboard preview in Xcode shows the right behavior for the configuration, but it is incorrect in the simulator for iPad 2 (7.1) and indeed for other iPad models as well when running iOS 7.1. The expected behaviour is seen for iOS 8.x in the simulator. This is therefore not a simulator vs. device issue. I suspect the reason why you were seeing different results in your simulator was just that you hadn't done a clean build since some critical change that caused this, so it was still using an old XIB, as these are cached longer than they should be sometimes.
CAUSES OF ISSUE? You are setting the device family of your project to target only iPad, but are including in your storyboard a size class of
Compact Width | Any Height
, a size class that an iPad should never use. That may be an aspect of the configuration that is triggering this issue. That said, it still shouldn't occur. This issue occurs with both Xcode 6.1 and is not different in the current 6.2 beta.There may be a specific aspect of your current configuration that is triggering this. In particular, auto layout and device targets are influenced by launch screens in some documented but often developer-unexpected ways. (For instance, using a storyboard for a launch screen will silently make your app available universally, even if you have specified it should be iPhone-only in your target.) There are other cases (see this Stack Overflow question and answer) where migrating launch images to a different configuration has resolved similar kinds of issues. So that would be worth trying.