How to use iOS Simulator 7 \ XCode 5 to test pre-i

2019-03-08 05:21发布

Compiling my app on XCode 4.6.3 and running it on iOS 7 works great.

Compiling my app on XCode 5 and running it on iOS 7 results a big UI mess I don't want to handle right now. (iOS 7 pickers, tabbars, tableviews etc')

Goal:

I want to be able to use XCode 5 and test my app on the iOS 7 simulator but still use the iOS 6 and lower UI and feel.

Reason:

I don't want to redesign my app to iOS 7 but I do want to make sure it runs fine on iOS 7 using XCode 5 iOS 7 simulator.

Is there a quick toggle on XCode 5 to force everything to stay the same?

Is doing something like using iOS 6 Base SDK in XCode 5 acceptable or a bit too much hacky?

Edit:

Using iOS 6 SDK doesn't help. You'll still get the iOS 7 look on your app, just more buggy.

13条回答
祖国的老花朵
2楼-- · 2019-03-08 06:17

Linking the 6.1 SDK into Xcode 5 as described in the other answers is one step. However this still doesn't solve the problem that running on iOS 7 new UI elements are taken, view controllers are made full-size etc.

As described in this answer it is also required to switch the UI into legacy mode on iOS 7:

// put in main.m
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"UIUseLegacyUI"];
[[NSUserDefaults standardUserDefaults] synchronize];

Beware: This is an undocumented key and not recommended for App Store builds!

Also there are subtle differences to a version built using Xcode 4.6. For instance, transparent navigation bars behave differently (causing the view to be full-size).

However, since Xcode 4.6.3 crashes on Mavericks (at least for me, see rdar://15318883), this is at least a solution to continue using Xcode 5 for debugging.

Update: the crash of Xcode 4.6.3 on Mavericks only occurs when using LLDB. When switching back to GDB it works.

查看更多
我想做一个坏孩纸
3楼-- · 2019-03-08 06:18

EDIT - Note that it is not possible to force an app to use the iOS 6 interface on an iOS 7 device using Xcode 5 (unless you make custom graphics). It is also not a good design approach. Users on iOS 7 expect a certain UI style, that's why they updated; so give it to them, don't force them back into an older interface.

If you really, really need the pre-iOS-7 interface, you can download a copy of Xcode 4 and build with that. However, starting February 1, 2014 Apple will stop accepting apps built with anything earlier than Xcode 5.0 (I think I saw something about that in the iOS 7 dev docs, but can't find the reference again).


Keeping the iOS 6 UI in your app, but building for iOS 7 is fairly straightforward. Make sure that you've set your Deployment Target as iOS 6.1 or earlier. Your Base SDK can still be set as iOS 7 though. Now, just follow the instructions below for each of your interface files:

  1. Open your storyboard file or XIB file
  2. Open the Utilities Panel on the right side.
  3. Click on The File Inspector Tab. You should now see something like this:

    Xcode 5 Utilities Panel and File Inspector

  4. Next go to the Interface Build Document Section and change the Builds For setting to iOS 6.0 and Later or whatever version you need.

    Xcode 5 Utilities Panel Interface Build Document Section

  5. Then change the View As setting to iOS 6.1 or earlier:

    Xcode 5 Interface Build Document Section - View As Setting

  6. Xcode will prompt you, just confirm that you want to convert to the older UI.

Make sure to run your project in the iOS 6 Simulator. Otherwise, the iOS 7 Simulator will override it's own iOS 7 UI style. To download the iOS 6 Simulator, go to the Xcode Menu Bar. Select Xcode, Preferences. Then click on the Downloads tab. Finally, click on the Simulator(s) you need to download:

enter image description here

Then Run your app on the iOS 6 simulator: enter image description here

Unfortunately, even disabling the iOS 7 UI in Xcode does not override it on the device / simulator. Unless you design custom UI elements, there isn't a way to maintain your iOS 6 UI on iOS 7. But as I showed you, you can continue to edit it in iOS 6 and build for iOS 6.

查看更多
Lonely孤独者°
4楼-- · 2019-03-08 06:20

Set deployment target to iOS 7.0 from deployment info. For that tap on project name and on first screen you will see deployment info... Change deployment target to 7.0. After that quit simulator, build and run app again.

查看更多
时光不老,我们不散
5楼-- · 2019-03-08 06:21

COPY iPhoneSimulator6.1.sdk

FROM

<YOUR XCode4 path>/Xcode4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/

TO

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

and set your base target to iOS6.1 (It will be listed after copying/pasting from xcode4) and

enter image description here enter image description here

查看更多
女痞
6楼-- · 2019-03-08 06:23

You cannot do this on the iOS 7 Simulator. You can do it in the iOS 6 Simulator (running under Xcode 5) and on the device (running iOS 7 as long as you build with the iOS 6 SDK). But there is no iOS 6 compatibility mode in the iOS 7 Simulator.

Note that iOS 6 compatibility mode is not a perfect replication of iOS 6. There are still various behavioral differences that you will likely have to test for and deal with. But the basic UI components are what you expect.

查看更多
闹够了就滚
7楼-- · 2019-03-08 06:24

This is the scenario:

  • Your app works fine on iOS 6 and lower
  • You want to test your app on iOS 7
  • If you have iOS 7 on your device you'll need XCode 5 in order to test it on it
  • If you want to test it on the iOS 7 simulator you'll need to install XCode 5 for it
  • Compiling your working app on XCode 5 will break all hell loose and will force you to redesign your app at least for iOS 7
  • The solutions suggested here so far will help you to see how your app will look like on iOS 7 but will not keep your iOS 6 and lower look on iOS 7.

Best solution I've found so far:

  1. Update your current XCode to XCode 5
  2. Download XCode 4.6.3 from here
  3. Install it in a different location and Change the name of the app to XCode4 in order to differentiate between the two.
  4. Find your XCode 5 app icon, right click it and select "Show Package Contents"
  5. Locate the folder MacOS and move the xcode file outside of its folder. Those last two steps are to prevent you accidentally opening a project with XCode 5. An alternative is to change the default "Open With" app but for some reason that didn't work for me plus I wanted to be extra sure after I had one project opening with XCode 5 and the StoryBoard changed to be compatible to XCode 5 only. *
  6. Open XCode 4.6.3 and run your project. In your simulator menu you should now See iOS 7. Even if in XCode top bar you'll see AppName->iPhone 6.1 Simulator , selecting iOS 7 on the simulator will run your app in iOS 7 and keep everything the same.

After the above you'll have two versions of iOS simulator. Version 6 and version 7 that contains iOS 7 Simulator.

Step 5:

enter image description here

查看更多
登录 后发表回答