EXC_BAD_ACCESS and GetParamCount

Hi,

I’m having trouble running an app on an IOS-device. The app starts and crashes with EXC_BAD_ACCESS which I presume is an invalid memory access attempt.

The app runs fine in Unity Editor and doesn’t give e.g. the message that a script is missing (see below).

I’ve tried the usual tricks: deleting temp-files and all the generated files, and restarting my Mac. No joy.

The app used to work fine with older versions of Unity & Xcode. Should I downgrade because honestly I can’t come up with any new ideas for possible workarounds. Nor could I find any advice from the net.

Thanks for everyone already in advance.

Here are the facts:

*Version numbers:

Unity: 5.1.1f1 Personal

XCode: 6.4 (6E35b)

*EXC_BAD_ACCESS -address & instruction:

0x1102df4 <+0>: ldrb.w r0, [r0, #0x22]

*Main thread stack trace:

#0 0x0112edf4 in il2cpp::vm::Method::GetParamCount(MethodInfo const*) at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/vm/Method.cpp:49

#1 0x009ba2f4 in il2cpp_invoke_method at /Users/builduser/buildslave/unity/build/Runtime/Scripting/Il2CppUtility.cpp:50

#2 0x00a785c0 in Invoke at /Users/builduser/buildslave/unity/build/Runtime/Scripting/Backend/ScriptingInvocation.cpp:128

#3 0x00a78532 in Invoke at /Users/builduser/buildslave/unity/build/Runtime/Scripting/Backend/ScriptingInvocation.cpp:108

#4 0x00a3a51c in ExecuteInitializeOnLoad at /Users/builduser/buildslave/unity/build/Runtime/Misc/RuntimeInitializeOnLoadManager.cpp:348

#5 0x00a3a3ee in ExecuteInitializeOnLoad at /Users/builduser/buildslave/unity/build/Runtime/Misc/RuntimeInitializeOnLoadManager.cpp:329

#6 0x00a32170 in PlayerLoadFirstScene at /Users/builduser/buildslave/unity/build/Runtime/Misc/Player.cpp:999

#7 0x00880e7c in UnityLoadApplication at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/LibEntryPoint.mm:230

#8 0x000fde20 in -[UnityAppController startUnity:] at /Users/kaitsu/Desktop/mindfulness/iosfullbuild/Classes/UnityAppController.mm:109

#9 0x2fc9e162 in __NSFireDelayedPerform ()

#10 0x2f289166 in CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION ()

#11 0x2f288d7e in __CFRunLoopDoTimer ()

#12 0x2f28711a in __CFRunLoopRun ()

#13 0x2f1f1ebe in CFRunLoopRunSpecific ()

#14 0x2f1f1ca2 in CFRunLoopRunInMode ()

#15 0x340f7662 in GSEventRunModal ()

#16 0x31b3e14c in UIApplicationMain ()

#17 0x000dd284 in main at /Users/kaitsu/Desktop/mindfulness/iosfullbuild/Classes/main.mm:40

*Debugger output (Xcode):

2015-08-06 17:00:42.087 mindfulness[4864:60b] → registered mono modules 0x1259fe0

→ applicationDidFinishLaunching()

→ applicationDidBecomeActive()

Requesting Resolution: 640x960

Renderer: PowerVR SGX 535

Vendor: Imagination Technologies

Version: OpenGL ES 2.0 IMGSGX535-97.7

GLES: 2

GL_OES_depth_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_half_float GL_OES_vertex_array_object GL_EXT_blend_minmax GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_draw_instanced GL_EXT_instanced_arrays GL_EXT_map_buffer_range GL_EXT_read_format_bgra GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_texture_lod GL_EXT_texture_filter_anisotropic GL_EXT_texture_storage GL_APPLE_copy_texture_levels GL_APPLE_framebuffer_multisample GL_APPLE_rgb_422 GL_APPLE_sync GL_APPLE_texture_format_BGRA8888 GL_APPLE_texture_max_level GL_IMG_read_format GL_IMG_texture_compression_pvrtc

OPENGL LOG: Creating OpenGL ES 2.0 graphics device

Initialize engine version: 5.1.1f1 (2046fc06d4d8)

The referenced script on this Behaviour is missing!

(Filename: Line: 1562)

The referenced script on this Behaviour is missing!

(Filename: Line: 1715)

A script behaviour has a different serialization layout when loading. (Read 32 bytes but expected 260 bytes)

Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

(Filename: Line: 1652)

WARNING: Shader Unsupported: ‘Hidden/TerrainEngine/Splatmap/Specular-AddPass’ - All passes removed

WARNING: Shader Unsupported: ‘Hidden/TerrainEngine/Splatmap/Standard-AddPass’ - All passes removed

WARNING: Shader Unsupported: ‘Hidden/TerrainEngine/Splatmap/Standard-Base’ - All passes removed

Shader ‘Nature/Terrain/Standard’: fallback shader ‘Nature/Terrain/Diffuse’ not found

WARNING: Shader Unsupported: ‘Nature/Terrain/Standard’ - All passes removed

WARNING: Shader Unsupported: ‘Nature/Terrain/Standard’ - Setting to default shader.

WARNING: Shader Unsupported: ‘Hidden/TerrainEngine/Splatmap/Standard-AddPass’ - All passes removed

WARNING: Shader Unsupported: ‘Hidden/TerrainEngine/Splatmap/Standard-Base’ - All passes removed

WARNING: Shader Unsupported: ‘Nature/Terrain/Specular’ - All passes removed

@Kai_Zu

We have seen this error before, although it could be caused by multiple issues. I can’t tell exactly what the cause is from this call stack alone. I would recommend trying this with the “Stripping Level” option in the Player Settings set to a value of “Disabled”, if you have not done that already. I suspect that something in the engine code is being incorrectly stripped.

You could also try the 5.1.2f1 version, which may have corrected this bug. If neither of these options work, please submit a bug report and let me know the bug report number. We will investigate this then.

The stripping level was already “Disabled” and that didn’t help. I downloaded Unity 5.1.2f1 and that resolved the problem. Now everything seems to run fine. There’s still the issue of Unity not being able to launch and command XCode automatically but that’s not such a problem because building the product manually works just fine.

Thank you for your assistance!