Unity and iOS SDK 4.3
Many of you have reported troubles submitting your applications built with iOS SDK 4.3 to the iOS AppStore. At the time, the problem looked very complex and because all the troubles were happening after application gets post-processed for AppStore on Apple’s side, there were only a few ineffective ways to trace it down. We mailed all registered Unity iOS developers with a basic recipe of how to get their applications onto the AppStore:
Dear Unity iOS Developers,
Unfortunately, many (and probably all) Unity iOS applications built with iOS SDK 4.3 are crashing during the App Store Review process while still running successfully on developer’s devices. We have contacted Apple regarding this issue and received confirmation that this is of highest priority to them. Our iOS team is working on a solution as well, but due to complex nature of the problem it will take longer than expected to properly resolve. A currently known workaround is to keep using iOS SDK 4.2.
Many users reported that applications built with Xcode 3.2.5 + iOS SDK 4.2 successfully pass the Apple App Store review process currently. OS SDK 4.2 is not publicly available on the iOS Developer site anymore, but it still can be downloaded via direct link. We want to assure you that building final applications with iOS SDK 4.2 provides all the features the Unity iOS run-time supports and is proven to work fine with devices running older generation iOS (3.x-4.2.x) as well as the newer devices running iOS 4.3.x (like iPad 2).
Please feel free to contact us if you have issues releasing your application to the App Store.
The Unity Team
Since then, we have spent many hours listening to your stories in forums, analyzing your builds, and trying out some ideas. We finally nailed the issue: iOS SDK 4.3 introduced a tiny problem with the native code linker improperly calculating how much code should be protected by the AppStore code protection system. The problem exposes itself only when AppStore protection is applied to the application.
Recently, a few forum users reported about successful submissions to the AppStore using iOS SDK 4.3. This led us to the solution (we would like to say big thanks to forum users “susantio” and “ratrodstudio”!). Our investigation of their projects revealed common use of the special linker flag “-all_load” (which is required by some 3rd party ObjC plugins). Using this flag forces iOS SDK 4.3 native linker to properly calculate protected code size and so it solves the problem.
Unity 3.4, which is just around the corner, will include this flag by default. If you can’t wait, you can try it sooner by applying few changes to your Xcode project by hand.
Instructions how to add this flag to your release build when using Xcode 3.2.6 (SDK 4.3):
1. Open your project in Xcode.
2. In the Xcode menu select Project->Edit Active Target.
3. In the Configuration drop down select “Release”.
4. In the Search field type “linker”.
5. Find the field named “Other Linker Flags” and double click on it.
6. Click “+” and add “-all_load”.
7. Clean all targets.
Instructions how to add this flag to your release build when using Xcode 4/4.0.2 (SDK 4.3):
1. Open your project in Xcode.
2. In the Project Navigator click on your project.
3. On the next pane select “Unity-iPhone” under TARGETS.
4. On the next pane select “Build Settings”.
5. In the Search field type “linker”.
6. Find the field named “Other Linker Flags” and double click on “Release” configuration near it.
7. Click “+” and add “-all_load”.
8. Clean all targets.
9. Make a distribution build by clicking “Product”->”Build For”->”Build For Archiving” (Note: don’t use Product->Build, because it will make “debug” build by default and won’t include “-all_load” flag).
We have received multiple confirmations from forum users that this helped them get into AppStore using iOS SDK 4.3. Also we are sharing all our findings with Apple, and we hope that this will help to get some fix included into SDK update.
As always please feel free to contact us if you have issues releasing your application to the AppStore or any platform.