6

Our build server was recently updated to use Xcode 5's xcodebuild. We've installed the iphoneos6.1 so that we can still use iPhone SDK 6.1 for some legacy projects that do not yet support iOS7. However, when we use xcodebuild to build these projects using -sdk iphoneos6.1, we still see problems with UIViewController's contents being laid out underneath navigation bars and tab bars.

Is there some way to build these projects that were developed with Xcode 4.6.3/base sdk iOS 6.1 using Xcode 5's xcodebuild, but preserving the views as they were laid out in the storyboard developed using Xcode 4.6.3? I took a look at the man page for ibtool, but I'm not seeing any option related to choosing a target SDK, or anything else that seems relevant to the "extends edges" problem I noted above.

Note that we haven't updated the storyboard using Xcode 5 - the project is continuing to be developed in Xcode 4.6.3, and only touches the Xcode 5 toolchain when our build server clones the project's git repo and builds using xcodebuild.

jscs
  • 63,694
  • 13
  • 151
  • 195
Greg
  • 33,450
  • 15
  • 93
  • 100
  • Is this happening when you're running the app in iOS 7? Or in 6.1? – dpassage Sep 19 '13 at 00:03
  • It's happening when running the app in iOS 7. When we build with Xcode 4.6.3, the app works correctly when running on either iOS 6 or 7. When we build with Xcode 5, the app works correctly when running on iOS 6, but view controller content extends under top/bottom bars when running on iOS 7. – Greg Sep 19 '13 at 00:19
  • Xcode 5 only has the iOS 7 SDK. When building against the new SDK, iOS 7 automatically uses the new behavior while iOS 6 will still run as normal as it knows nothing else. When building with older Xcodes, older SDKs are used and iOS 7 assumes that the application has not been updated to use iOS 7 features and so shows the app as iOS 6 would. – BergQuester Sep 19 '13 at 01:43
  • @BergQuester, I symlinked the iphoneos6.1 sdk so that it would be available in Xcode 5 as described here: http://stackoverflow.com/questions/18423896/is-it-possible-to-install-ios-6-sdk-on-xcode-5, and chose that SDK as the base SDK. You're right though, even though I've selected the iphoneos6.1 sdk as the base SDK, some (but not all) of the iOS 7 features are present in the compiled app. In addition to content extending under bars, I'm also seeing a translucent navigation bar, but I'm not seeing the navigation bar color extend to the status bar like I do when base sdk is set to iOS 7. – Greg Sep 19 '13 at 03:12
  • I personally don't trust hacking Xcode like that as it's not a combination that Apple has tested. It sounds like, then, that there is probably a flag that Xcode 5 sets when compiling that causes iOS 7 to behave that way. Ideally Apple would include the previous SDK or two. In lieu of that, I'd be more comfortable with separate build servers for two versions of Xcode than hacking an older SDK in. Depending on your situation, you could even the older Xcode running in a VM on your build server to avoid needed separate machines. – BergQuester Sep 19 '13 at 04:20
  • Yeah, that looks like the option we'll be using (separate build environment for projects still on 4.6.3). – Greg Sep 19 '13 at 04:31
  • I meet the same problem.@Greg, do you find any other solution rather than use two versions of Xcode to make build? – realsnake Sep 23 '13 at 02:10
  • Sorry, haven't found any other solutions for this. – Greg Sep 23 '13 at 16:22

2 Answers2

0

Yes. On the Storyboard, go to the Interface Build Document section and there are two selection items. One for Builds For and one for View As. You can select anything from 7.0 down to 4.3 for the Builds For and you can select '7.0 and later' or '6.1 and earlier'.

enter image description here

Mark S.
  • 3,849
  • 4
  • 20
  • 22
  • Thanks for the suggestion. I tried altering both the "builds for" and "view as" values, but they did not resolve the problem - I'm still seeing content extend under top/bottom bars. I think I'll just have to bite the bullet and start tweaking the storyboard in Xcode 5. – Greg Sep 19 '13 at 00:26
  • @Greg for your problem.. click on your Viewcontroller... and for "Extended edge" uncheck "Under top bars".."Under bottom bars"... etc – TonyMkenu Sep 19 '13 at 08:42
  • @TonyMkenu, thanks, I'm aware of this option, but this is for a legacy project that we're trying to migrate to a new build server running Xcode 5, without actually modifying the project if possible. It looks like we'll need to move to having two build environments, one for projects that are migrated to Xcode 5 and the other for projects that remain on Xcode 4.6.3 for now. – Greg Sep 19 '13 at 20:15
0

While it isn't exactly what you are looking for, you can keep both Xcode 4 and Xcode 5 in the same build environment and control which xcodebuild is run by using an environment variable (see man page for xcrun. We have just set this up on one of our build servers. In your build definition, just set the following environment variable:

DEVELOPER_DIR=<path to Xcode 4.app>/Contents/Developer

For us, it ended up as:

DEVELOPER_DIR=/Applications/Xcode-4.app/Contents/Developer

This overrides the xcode-select setting and allows you to use the correct Xcode environment. Again, this depends on the ability of your build system to set environment variables, plus having both versions of Xcode installed. You can download older versions of code at Downloads for Apple Developers

Michael McGuire
  • 3,770
  • 2
  • 29
  • 28