iOS Rename Main Thread

Attention iOS DEVs! Rename your main thread!

If you are fortunate enough to have instrumentation built into your app using Hockey App or something similar, then you probably won’t need this tip, but for the rest…

Add this to your app delegate in didFinishLaunchingWithOptions:

Simulate a crash with
*(char*)0 = 0;

Debug Navigator

Validate your thread name using the XCode Debug Navigator.  The crash you added will halt the app and should automatically show you the thread name. If not, hit Command-5 on your keyboard.

If you run this on a device, you should generate a crash report. Notice the named thread in the report.

I can’t take full credit for the idea – we received a crash log via email today and didn’t know which version they were using. This idea was a result of our discussion.

Anyone else have helpful tips to share?