iPhone OS 3.1.2 + Xcode 3.1.4 + Unity iPhone 1.5.1 Build problems ?

I've been having problems building my project with Xcode 3.1.4, for target Device 3.1.2|Release. This happened both with Unity 1.5.0 and 1.5.1

Here's the error: ldr 12-bit displacement out of range (5976 max +/-4096) in _AudioQueueAddPropertyListener$stub in _AudioQueueAddPropertyListener$stub

This also happens with OS target 3.1

If I choose OS target 3.0, and Code signing for iPhone Developer, it works just fine. If I choose OS target 3.0, but choose Code signing for iPhone Distribution, the game builds, shows the splash screen, and then crashes with an error like: 'Error launching remote program: failed to get the task for process 1702' (the process number is different each time it runs).

I haven't done any changes in X-code to the project, I left it as Unity puts it out. Any advice on this would be much appreciated.

Also, if you have any experience on which OS version would be best for submitting the game to the AppStore, please share (2.2.1/3.0/3.1/3.1.2)

Thank you!

Select 2.2.1 as a build target in XCode.

Generally you want to avoid compiling for latest OS anyway, as it shrinks your customer base - only those who have latest OS will be able to install your application.

This is a known bug in XCode. You have to use iPhone OS 3.0 until Apple fixes it...

try to set GCC_THUMB_SUPPORT = NO

The problem still happens in Unity 3.3 / XCode 3.2.5 / iOS 4.2 :-(

To solve it, set the 'target iOS version' to 3.0 in the player settings in Unity. (thanks to Denis Simuntis from Unity for providing this answer)