Getting Unity-iPhone To Work with Xcode 5 And iOS 7

Getting Unity-iPhone To Work with Xcode 5 And iOS 7

I just updated to iOS 7 and ran into some small problems. So here is what I found out about how to get my Unity project to work with iOS 7 and XCode 5. I still stick to version 3.5.7 but most issues apply to 4.x as well.

Build & Run Doesn’t Work

Hit CMD+B for Build & Run and you get the following error in consle view:

UnityException: Launching iOS project via Xcode4 failed. Check editor log for details.

At the time of this writing there seem to be problems to reopen Xcode due to interface changes or whatever s Alexey’s answer in Unity and iOS 7 – Building. Suggested solution Build and open Xcode manually works fine.

 

Bunch of Linker Errors

Something like:

Apple Mach-O Linker Error "UnityInputProcess()", referenced from: -[AppController Repaint] in AppController.o
Apple Mach-O Linker Error „UnityInputProcess()“, referenced from: -[AppController Repaint] in AppController.o

OK my fault because the current selection of active scheme in Xcode looks different now:

Active Scheme in Xcode

My test device was an iPhone 4 so I read iPhone and 4 but didn’t realise that this is now the Simulator for iPhone.

 

Statusbar Not Hidden

Apple has changed the appearance of the status bar In iOS 7 (see for example iOS 7 status bar back to iOS 6 style? or Wrestling with Status Bars and Navigation Bars on iOS 7 for more information).

To put it short: Add a new key UIViewControllerBasedStatusBarAppearance set to NO to your info.plist (appears as „View controller-based status bar appearance“).

As this will be overwritten on every new build from Unity you need to perform the modifications within Xcode’s build process. The easiest way I found to do this is providing a bash script in the project directory which calls defaults write:

# Code executed as „Build Pre-Action“ from Unity-iPhone scheme
my_domain=${PROJECT_DIR}/Info.plist
status_bar_key=UIViewControllerBasedStatusBarAppearance
defaults write $my_domain $status_bar_key -boolean NO

Save this as modify_info_plist.sh in your project directory. Then in Xcode go to Unity-iPhone / Edit Scheme and define a Pre-Action in the Build section:

Build Pre-Action

Note that you have to choose Unity-iPhone from selection Provide build settings from (default is None)

Now your script is executed before the build action, but you can’t see it in Xcode :-(( The modification is done but Xcode is not able to reflect the change in file system. If you want to see it in Xcode close the project and reopen it – somewhat poor.

 

App Icons: „No Image With Correct Dimensions Found“

Look at your Unity-iPhone project file, section General:

Warnings No Image With Correct Dimensions Found

 

In Unity forum posting Recommended Xcode versions Unity developer Mantas Puida explicitly advises to not use Asset Catalog feature in Xcode as it is not supported. Instead they should be added „via Xcode interface when doing final distribution build„.

On the other hand there is a nice blog posting Easing Submission Pain With Unity & Xcode 5 describing how to use Asset Catalogs in your Unity project. I haven’t tried it out. It seems like both ways include a lot of manual doing (just my guts feeling) and git or whatever version control will have to be in place to restore all things overwritten with every new Unity build. Maybe another build action is needed to copy these images or perform some „git checkout — “ commands.

 

Detecting New Hardware iPhone 5s and 5c

Until now iPhone.generation provides no additional information for the new devices. I don’t own one yet to test it, but my guess is that the result is not reliable. To get around this user CharlesBarros provided his code for a small plugin to detect the hardware from version string in the forum thread Unity 3.5.7 and iOS 7. Something similar is expected to come in a future Unity 4 release.

I haven’t tested it but it looks fine and I will use it if Unity does not provide a 3.5.7 patch in the future which will be the better solution (Update 27-Sep-2013: Charles has published IPhoneDeviceModel to the Unify Community Wiki).
A similar solution called UIDeviceHardware.h can be found at GitHub

 

Performance on iPhone 4

I started RRRunner on an iPhone 4 running iOS 7. My first impression was that it runs slowlier than under 6.1.3 and I definitely noticed a performance decrease in my app. Then I tested a well defined scenario (repeating level 1 automatically for 15 minutes) using the built-in profiler. I just measured this a few days ago and the code remained unchanged within this time. The measurements revealed a frame rate drop by 13 % compared to 6.1.3 which is frustrating after I just managed to get 30 FPS stable on older devices. Several people are reporting similar observations:
The Apple iOS 7: Advantages and Disadvantages
iOS 7: What iPhone, iPad owners need to know

As you can’t prevent users from updates (what a pity 😉 the only thing to do is provide even lower quality settings when running on iPhone 4 maybe combined with a more sophisticated system of hardware detection that includes the iOS version.

Maybe there are some more settings to tweak or hopefully an iOS upgrade will improve the performance.

Update: With iOS versions 7.0.2 and 7.0.3 the performance went up. Although it is still worse than under 6.1.3, RRRunner can be pleayed now in most levels with 30 FPS.

Comments are closed.

Durch die weitere Nutzung der Webseite stimmen Sie der Verwendung von Cookies zu Mehr
By continuing to use the site, you agree to the use of cookies. More

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close