Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios 7 simulator wouldn't fallback user interface for apps compiled against ios 6.1 sdk

Tags:

xcode

ios

iphone

Our ios6.1-sdk-compiled app has been running fine on ios 6.1 iphone 4, 4s & 5 devices. When running the app on ios7 iphone 5s the user interface still looks like ios 6 (black buttons etc) but we're fine with most of it, except we found a bug. I'm guessing this is because changes on API implementation on ios7.

When our app is compiled against ios7-sdk on xcode 5 everything falls apart. UI objects are misaligned, label's can't be read etc. Hence we want to compile our code against ios6.1 sdk but run it on ios 7.

On Xcode 5 I've installed ios 6.1 sdk by copying it from Xcode 4.6.3 dmg as described on this post and updated Base SDK to ios 6.1 on build settings, however when running the app on ios 7 simulator the user interface wouldn't fall back to ios 6.1. It does however fall back to ios 6.1 if the app is tested against a physical iphone running ios 7.

How can I make ios 7 simulator falls back user interface when running ios6-sdk-compiled apps so we can reproduce the bug on simulator?

like image 854
gerrytan Avatar asked Sep 24 '13 02:09

gerrytan


2 Answers

If I understand your issue correctly... I have been running into the same problem with our app and needed to keep the iOS6.1 interface, built in Xcode 5 and running in iOS7. Our interface was also messed up, misaligned and toolbars missing buttons. We will fix it later for 7, but don't have time right now, but need it to run on iOS7 and be built in Xcode 5 still.

So here's what I did: (I'd like to post some screen shots, but don't have my mac handy, will get later if needed)

  • I kept Xcode 4.6.3 installed along with Xcode 5.
  • I added symlink from 6.1 SDK into the Xcode 5 installation. (I found a SO question on that, will find a link) Or you can install it like you did.

(these next 2 options may not be needed, but we ended up using them in testing, and it works, even the new 5S 64bit phone)

  • In Build Settings I selected build architectures to use the standard, non-64bit armv7 option, don't pick the "including 64bit" choice.

  • same place, Build Active Architecture Only to Yes

Then...

  • also in Build Settings, set Base SDK to iOS 6.1. (I believe this was the key to make it work)

  • General tab of app target, set Deployment Target to 6.1 (ours is still on 5.1, for now)

  • In our Storyboards, select File Inspector, in the Interface builder section I selected opens in Xcode 4.6, and Builds for iOS 5.1 and Later, and view as iOS 6.1 and Earlier. (my autolayout is unchecked, we don't use it)

Warning about that last option for "opens in". If you select "opens in Xcode 4.6", you will lose Storyboard editing for iOS7. In my case, I don't care for now, because I want it to stay in 4.6 views anyway. Just keep that in mind. I think you can switch it back, but haven't tested.

With the 6.1 SDK linked/installed, you should be able to select the desired iOS version for use in the simulator when you run in the the app. You will see it in the Active Schema drop down in the top toolbar. In my case, I can for example, select iPhone Retina (4-inch) and below that I have option for iOS7 or 6.1. The interesting part for me is, with the settings above, I am able run my app in the simulator and it looks like iOS6 even if I select iOS7 as the simulator active schema. It even worked in the 64bit simulator which, in my setup, will only show iOS7 selection.

At least this way I can build and work in Xcode 5, ad-hoc distribute the app for iOS7 users, but keep the iOS6 styles, placements and buttons intact. Now I can spend more time making the transition to iOS7 styles, but can still fix bugs and update the app as if it were iOS6.1.

I hope that makes sense, and I hope it answered your question. And I hope I remembered everything I did! I'll add more if I think of something.

like image 124
gregthegeek Avatar answered Oct 24 '22 09:10

gregthegeek


Thanks all for the help but so far best workaround that allows me to reproduce the bug is to keep using xcode 4.6.3 and install ios 7 simulator into xcode 4.6.3.

I did so by installing both xcode 5 and 4.6.3 side by side (copy xcode.app into xcode4.6.3.app then install xcode 5 from app store (will overwrite xcode.app)), then symlink

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk

to

/Applications/Xcode4.6.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk

Make sure xcode isn't open when this is performed. If you already overwritten 4.6.3 to 5 you can download dmg of 4.6.3 from https://developer.apple.com/downloads.

Then I put:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iOS Simulator.app

(ie: xcode 5 version of the simulator app) on my dock

When testing the app, I had to manually launch the simulator from the dock first and select corresponding device version (go to Hardware -> Device -> select iphone 3.5"/4" - ios6/7) because xcode 4.6.3 wasn't able to automatically do this (presumably because of version difference / because I didn't symlink the xcode 5 simulator app to 4.6.3)

When launching, ensure 'iPhone 7.0 Simulator' is selected on xcode 4.6.3 Scheme. The ios6.1-sdk compiled app then falls back into ios 6.1 UI when run on ios 7 and I can reproduce my bug.

like image 4
gerrytan Avatar answered Oct 24 '22 09:10

gerrytan