iOS Build Environment Help Center

Getting crash upon app launch. Remote debugger not providing useful information

append delete Shivang

Hi there! Thanks for making this tool it seems awesome.

After doing a build I'm able to successfully scan the QR code and install the app on my iPhone 13. When I launch it, however, it shows a black/gray screen for about 2 seconds then crashes every time.

I'm trying to figure out what the exact error is. As you can see in the output (https://pastebin.com/raw/vYhUq36i) there doesn't seem to be any useful information.

I've tried enabling a debug build in Unity hoping that would provide more helpful information and it hasn't. I've tried the help steps in the docs, like making sure the iOS version is < my phone version and such but not been successful. Any help in debugging would be greatly appreciated!

MY SYSTEM INFO:

• Windows version: Windows 10
• Builder version: 3.47
• iOS SDK version: iOS SDK 15.0

Reply RSS

Replies

append delete #1. Pierre-Marie Baty

Hello

Interesting. The app is properly launched as far as I can tell, because you get the engine initialization messages.

If it was killed by iOS, or if it was a crash, you'd get a stack trace in the logs. And if it was a "own will" exit, you'd get a closing message. As you seem to be getting none of these I'm unable to tell what's happening.

You might get more information about this crash by turning on the display of the iOS system logs (requires a USB cable). With adequate filtering/highlighting, I'm confident you'll get clues there.

append delete #2. Shivang

Hey!

Great call on the systems logs. The error is an out of memory error:

May 18 22:33:00.252 Shivangs-iPhone kernel[0]<Notice>: EXC_RESOURCE -> Serenity[55726] exceeded mem limit: ActiveHard 3072 MB (fatal)

This shows up every time I open the app. Do you think it's a guarantee that it's a problem with my app and not the build tooling? I think it's my app's fault, but I'm just really confused because I created an empty blank scene and just built the project with that so I can't understand why there would be an out of memory error.

append delete #3. Pierre-Marie Baty

Interesting. So that's the symptom of a memory exhausted error. The iOS kernel sends a SIGKILL message to your app and it shuts down immediately without being given even the ability to run any shutdown code.

The operating system already uses RAM up to a certain level. Given the device model (especially if it's old), iOS version, and the number of installed apps (especially apps that run background tasks or services), the available memory for new apps may be too low for yours.

At the moment I don't think the toolchain would be the culprit (until I am shown that the very same Xcode project, when built on macOS, doesn't exhibit the same symptom when deployed on the very same device). But the Unity engine is likely to consume a lot of RAM indeed. Maybe you're running your app on a hardware ecosystem that's out of its specifications ?

append delete #4. Shivang

Hey, great call. So I built the app on a macbook with xcode and I get the same exact crash. I'm going to spend some time building a completely blank project and seeing if that will work.

I have a suspicion it's my sprites and such. It's kind of surprising Unity loads them during an empty scene but maybe there's some issue. A blank project will put all doubts to rest.

Will report back! Thanks again for the great tool and help.

append delete #5. Shivang

Aha! An empty project worked and is running on my iPhone 13 Pro Max. My mind is blown. So despite being an empty scene, it must be something about my textures, scripts, sprites, etc, is causing an out of memory error in my game.

That's something I can spend my own time debugging, thanks again for your help!

append delete #6. Shivang

Apparently this is a known issue with the newer versions of iOS, Xcode, Metal, etc. They effectively use double the RAM as previous versions so I guess we need to REALLY optimize our Unity3D games now. Sounds like a pain.

https://forum.unity.com/threads/ios-large-memory-usage-apparently-feature-not-a-bug.637660/

append delete #7. Pierre-Marie Baty

Wow. Strange choice by Unity here. I hope the benefits of these inflated memory requirements were well worth their expense.

Good luck in optimizing all that…

:: @Pierre-Marie Baty added on 20 May ’22 · 06:53

*edit* as I understand it it’s not Unity’s fault but rather Apple that ditches OpenGL further and attempts to force everyone to use Metal-specific ways of coding, resulting in less portable code. I think the Unity engine could improve their memory usage at the expense of a big rewrite, which they’re probably reluctant to do because it would involve maintaining a large branch of very OS-specific and non portable code.

append delete #8. Shivang44

Just wanted to follow up to say that I was able to optimize settings and fix the iOS crash.

This is an incredible tool you've made. More people should know about it. It's saving me so much development time.

append delete #9. Pierre-Marie Baty

Thank you very much for your appreciation. Please spread the word about it if you feel so: by philosophical choice, that's my only source of publicity.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Moderators: Pierre-Marie Baty