Unity iPhone Problems and Solutions

SOP:
 * 1) Make sure you are running a debug version of the app.
 * 2) Make sure your linker flags have "-Wl,-S,-x" (Go To Project Settings, Build, Other Linker Flags)
 * 3) Do a debug run on Xcode and display the debugger console.
 * 4) Type “bt” to get a backtrace on the main thread, and “thread apply all bt” to see the backtrace of all the running threads of your app.
 * 5) If nothing useful comes out, type “c” to continue the execution then try displaying the backtrace again, until something (perhaps a backtrace to one of your Unity scripts) arises.

Problem: Xcode build failed: _mono_aot_module..._info referenced from: _mono_aot_module_..._info $non_lazy_ptr in RegisterMonoModules.o (maybe you meant: _mono_aot_module_..._info $non_lazy_ptr) Symbols(s) not found

Possible Causes: Unknown cause, possibly a bug in the Unity iPhone build pipeline itself.

Possible Solutions: Delete the Xcode project and recreate it from Unity.

Problem: Program received signal: “0”.

Possible Causes: If you get "Received memory warning... WARNING -> applicationDidReceiveMemoryWarning" most likely you ran out of memory.

Possible Solutions (this is assuming you are using a device older than the iPhone 4):
 * Make sure scene only has an average of 7,000 tris, give or take a few thousand.
 * Make sure music is compressed, preferably 1 MB at most per file.
 * Keep texture dimensions low. 128x128 is sufficient for single characters or buildings. Use 32x32 or 16x16 for small objects. Greater resolutions are ok for texture atlases.
 * Use texture atlases.
 * Make sure textures are compressed to PVRTC format (in Import Settings), 2 bits if possible, or 4 bits if 2 looks too ugly. PVRTC compression will not take place if your texture’s dimensions are not in power of two. GUI images generally don’t need to be PVRTC compressed but mesh textures should be.
 * Remove mip-map generation (in Import Settings) if the texture is used for the GUI. In Unity 3, this is automatically done if you set your texture type to GUI.
 * Limit the usage of full-screen GUI backgrounds, they eat up a lot of memory.
 * Don't load everything all at once. For example, making an array of Texture2D and putting images there will cause Unity to load all of those all at once. Don't do this, unless you need all of them on-screen all at the same time, instead, use Resources.Load to load only the one you need at that time, then call Destroy on it when not needed anymore.
 * Keep particle count low. Try increasing the particle’s size to make up for the lowered particle count.
 * Review the scripts you have downloaded from the Internet. Most likely they were made for a desktop computer in mind, making use of lots of memory an iPhone device doesn’t have.

Problem: Program crashes and debugger reports: “Failed to load AOT module ... in aot-only mode.”

Possible Causes: Unknown cause. Possibly another bug in the Unity iPhone build pipeline.

Possible Solution: Delete the app in the device (using Xcode Organizer) then install it again.

Problem: Receiving “SIGBUS” signal

Possible Causes: Most likely a null reference exception in the Unity scripts.

Possible Solution: Check your code in Unity for null reference exceptions. Use the backtrace to pinpoint where in your code the error happens.

Problem: Receiving “EXC_BAD_ACCESS” signal

Possible Causes: Most likely a null reference exception in the Unity scripts.

Possible Solution: Check your code in Unity for null reference exceptions. Unfortunately, Xcode does not produce a useful backtrace in this situation. You'll have to figure things out from the Unity editor. Alternatively, you can try the method explained here.

Problem: Receiving “SIGSEGV” signal

Possible Cause 1: Most likely caused by out of memory errors.

Possible Solution: See notes on out of memory problem.

Possible Cause 2: Unity iPhone 1.7 has a problem with C# GetComponent and GetComponentsInChildren when used with generics.

Possible Solution: Use the non-generic format instead.

Problem: When creating a new build: Error building Player: FileNotFoundException: Could not find file ".../Temp/StagingArea/iPhone-Trampoline/Unity-iPhone.xcodeproj/User.pbxuser". UnityEditor.HostView:OnGUI

Possible Cause: Unknown

Possible Solution: Close Unity, delete the Temp folder in your project if it exists, then try making a build again.

Possible Solution 2: Make a script with BuildPipeline and set its options to BuildOptions.None