I’ve been using Unity3D for a few years but only recently got the iPhone Basic version (so I’m new to some of this iPhone stuff). I have finally gotten my game on an iPhone 4 for testing. But I also have an iPhone 3G I want to test it on. So I’ve added that device to my profile. But I am having trouble testing my Unity project on the 3G.
My iPhone 3G has iOS 4.2 on it, but I have downloaded and installed the iOS SDK 5 on my Mac Unity computer. When I try to compile and then run my game on the 3G it compiles fine but does not run or appear on the iPhone 3G at all (it works fine on the iPhone 4). My guess is that this is happening because I am compiling it with the iOS SDK 5 on my Mac and not SDK 4.2 (which is the iOS version on my 3G). Is that correct? Do I have to compile with the same version of SDK that the phone has on it? If so, where can I find the iOS SDK 4.2 because I can only seem to find the current version 5 on the Apple Dev Center. Can you easily get older SDK versions?
And just to confirm, if I want to target iPhones back to the 3G or 3GS, do I have to compile with the iOS SDK version that was used back then (4.2)? Or can I somehow use new SDKs (5) that still work on older iPhones?
This will help you (I think it’ll be fixed with Unity 3.5 but I haven’t tried it with the dev preview yet):
Forget about running your project in the simulator with old iOS versions.
Replace (not append) when you save in Unity (i.e. Build)
When you first open the project in Xcode ‘Validate Settings’, it will ask you to replace the 3.1 with 3.2 project settings, so replace (in the middle of XCode at the bottom)
In your project seeting make sure iOS is set to use the ‘latest’ SDK
At the top of XCode it always chooses simulator but change this to be the device you want to install your build on.
Thanks for the reply Goat, but unfortunately that did not help me. I am able to compile and run my Unity game just fine on my iPhone 4 using the iOS SDK v5 (the only SDK I have installed). But when I try to run it on my iPhone 3G, it says it compiled fine and that it is “running on my iPhone 3G device” but nothing happens. It never appears on my iPhone 3G and I get no errors. So it works fine on the iPhone 4, but something is going wrong for the iPhone 3G.
I think my problem has to do with my iPhone 3G only having iOS 4.2 on it (the latest version it can support) and I’m compiling with iOS SDK 5 (but I am not sure). Can I compile my project with a more recent version of the iOS SDK than my iPhone is using? I’m trying to get confirmation on how these versions should line up. And if you have any other ideas about why this project works fine on my iPhone 4 but just fails without even getting on my iPhone 3G without errors, please let me know.
Graham, what you should be able to do is setup your project to build against SDK v.5 but have it compatible with devices running iOS v4.x. In Unity, go to Player Settings and in the inspector try setting the following:
SDK Version: iOS latest
Target iOS Version: 4.0
This means the XCode project generated by Unity will be setup to build with the latest SDK (v.5 in your case), but be compatible with devices using iOS 4.0 and higher.
There is one other change I needed to make in order to test this on an older iPhone (3G). I had to change the architecture setting in player settings from armv6 + armv7 to just armv6 (as that is the only version supported on older iPhones and iPod Touches). This is the main reason why my project would build fine but wouldn’t transfer or run on an iPhone 3G. It took me a while to find that out (since there was no useful error message).
I didn’t change anything like that in Xcode. In Unity I originally selected armv6+armv7 and when I opened it in XCode it only showed armv7 in the architecture settings. (which wouldn’t run on my iPhone 3G). I had to select only armv6 in Unity for it to work.
Is there some way I can get “armv6+armv7” to work on an iPhone 3G?