iOS Xcode Error: Thread 1: EXC_BAD_ACCESS

I’m getting a crash error whenever I run my iOS app with Xcode debugging on? When I run it without Xcode it runs okay at this point, but usually crashes shortly thereafter (or at least some of the buttons stop working).

The line that’s being highlighted is line 59814 (!) of Assembly-CSharp.dll.s in the Libraries folder of my app:

bl p_113

The highlight itself says Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

Anybody know what this means? It occurs when I open up a UI menu in my app (not the first UI menu, it honestly seems pretty arbitrary). Latest Xcode, Unity 5.0.1f1, latest iOS version on an iPhone 5S, if it helps.

Here’s a screenshot of the issue:

Thanks!

Solved! For anyone wondering, it was a null reference error that the editor didn’t catch - it ran only in code available on the iPhone.

Null reference errors: because you always have the capacity to be an idiot.

(Also note that I was able to find it by the list on the far left, Thread 1, at the top it had the problem function highlighted which I didn’t notice before - in this case, UIManager > UpdateIAPCurrency)

Hey thanks for sharing the solution. Any tips on how to efficiently debug this? I have a similar error and it is coming from NodeCanvas plugin. Is there a way to see the name of the game object that is causing the error?

@nyonge @vicwlau Thanks for the guidance but can you explain if you were able to identify which gameobject was causing the problem? I am currently getting this error as well.

Great insight! I had the same error with a MacOS build, Xcode, and Unity version 2020.2.0f1. Turns out I had a null exception error with the first level I was loading.

Because of a foo = GameObject.Find("MyTransformName").GetComponent() null error without some kind of if(foo != null) check, the exception error threw off Xcode but worked fine in Unity. Goes to show, make sure you fix all your errors before upload. Thanks for the heads up.

It’s possible also to get “silent errors”, things that Unity won’t catch but do fail in the final build whether it’s HTML5 or iOs or whatever. It’s rare once you know in your code where it can happen; takes a little guess work. Lesson learned: keep your code clean!