18

So, I have an universal project enter image description here

The "deployment info" section looks like this: enter image description here

I then duplicate the target enter image description here

I expect the two targets to be identical and in fact they seem the same in everything, but one detail is different in the duplicated one: enter image description here

the duplicated target has 2 tabs to choose different options for iPad and Iphone; this makes really sense because with universal I can choose the check different stuff. The original target seems to show only the iPhone options though. I know I can change iPad's options elsewhere but I can't understand why this is different

Now the question is: am I missing something? Are the targets really identical or am I doing something wrong? Is it an Xcode bug?

Everything works properly as it should, the targets are identical, but I am a little afraid there could be some problems in future.

Thank you very much!

J.Williams
  • 1,417
  • 1
  • 20
  • 22
  • I've exactly the same problem after duplicating a target. Everything seems to work but it is weird... Have you found what's the caus ? – fstephany Aug 31 '15 at 13:53
  • No, I think is just a bug. Everything works anyway.. Probably is a not documented feature;) – J.Williams Aug 31 '15 at 16:21
  • Yep. Good to know that we are not the only ones anyway ;) – fstephany Sep 01 '15 at 09:24
  • I'm having this same problem. I have the separate `iPhone` and `iPad` buttons in the original target, but those are replaced with the dropdown menu in the copied target. I just found this odd and it didn't worry me, until I noticed some differences between the two targets in how some specific Autolayout UIs are being handled (with the second target having bugs when running the exact same code that works perfectly for the original target). I would love to know what's going on here and why the built apps for the two different targets don't behave the same. :-( – Erik van der Neut Nov 12 '15 at 01:33

2 Answers2

21

I found the attribute which affect the display behavior of Xcode deployment info:

In the PBXProject section of project.pbxproj file, there are lines looks like:

            TargetAttributes = {
                22CFA0081BE46E9A00A89E90 = {
                    CreatedOnToolsVersion = 7.2;
                };
            };

If this attribute exists in the project, the Xcode will not display "iPhone" and "iPad" buttons . Just remove these lines, then the buttons will show.

This should be a bug of Xcode7.2

Dayong Xie
  • 211
  • 2
  • 6
  • Newly created universal projects (in Xcode 7.2.1) do not have the iPhone/iPad buttons. Are they supposed to? – Mark Krenek Feb 18 '16 at 14:45
  • 1
    On any "CreatedOnToolsVersion" you can simply remove it, and it work again ! – Romuald Mar 15 '16 at 11:07
  • Thank you! I had the same issue with Xcode 7.3. One target allowed me to select iPad and iPhone separately, my original (oldest) target didn't. Removing all occurrences of `CreatedOnToolsVersion = x.x;` fixed this. – Kymer Jan 27 '17 at 14:00
  • project.pbxproj file remove CreatedOnToolsVersion lines TargetAttributes = { XXXXXXXXXXXXXXXXXXXXXXXXX = { CreatedOnToolsVersion = 8.3; //that }; }; – iHTCboy Aug 10 '17 at 12:28
  • This is still happening in Xcode 10.1 (10B61) :( but the fix still works! – taber Feb 05 '19 at 15:23
2

I found this same problem today in my project. But I needed a solution because it was not respecting my orientation settings on the original target when using an iPad.

I made a copy of the already duplicated target. This solution worked, but I abandoned it to limit my risk to our production build settings.

I ended up just modifying the appropriate ProjectX-Info.plist file Locating the "Supported Interface orientations (iPad)" key and adding all 4 orientations. (Replacing "ProjectX" with your Target)

I am using Xcode 7.0.1 (7A1001) and hope it is fixed in a future release

Marty Cullen
  • 210
  • 1
  • 7
  • 1
    This other question has a visual of how to implement this: https://stackoverflow.com/questions/30536616/swift-allow-rotation-on-ipad-only – Jon Schneider Nov 05 '19 at 20:11