Today, I was trying to test my application for any localization errors. My application is available in english and french. I test my english version on an iPhone 3GS running in english and my french version on a first generation iPod touch running in french. Much to my surprise, the english version was working perfectly but my french wasn't. What could be the cause?
The symptom was pretty simple: upon startup, the application was crashing after 4-5 seconds. First, I thought it was an adhoc profile issue. I decided to remove the adhoc profile I was using and install the latest one. Same result. The application was crashing just while starting up. Then I remembered: application crashing because of wrong provisioning profiles crashed much faster than what I was experiencing (less than 1 second!).
I decided to give a look at the iPod touch device console with Xcode organizer. What I found out pretty telling. Look at the following crash excerpt.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x00090b2c __kill + 8
1 libSystem.B.dylib 0x00090b1a kill + 4
2 libSystem.B.dylib 0x00090b0e raise + 10
3 libSystem.B.dylib 0x000a7e34 abort + 36
4 libstdc++.6.dylib 0x00066390 __gnu_cxx::__verbose_terminate_handler() + 588
5 libobjc.A.dylib 0x00008898 _objc_terminate + 160
6 libstdc++.6.dylib 0x00063a84 __cxxabiv1::__terminate(void (*)()) + 76
7 libstdc++.6.dylib 0x00063afc std::terminate() + 16
8 libstdc++.6.dylib 0x00063c24 __cxa_throw + 100
9 libobjc.A.dylib 0x00006e54 objc_exception_throw + 104
10 CoreFoundation 0x00026b2c +[NSException raise:format:arguments:] + 76
11 CoreFoundation 0x00026acc +[NSException raise:format:] + 24
12 UIKit 0x0006ce64 -[UITabBar setItems:animated:] + 88
13 UIKit 0x0025a92c -[UITabBar initWithCoder:] + 140
14 Foundation 0x000566c6 _decodeObjectBinary + 1066
15 Foundation 0x00056230 _decodeObject + 196
16 Foundation 0x000560fc -[NSKeyedUnarchiver decodeObjectForKey:] + 60
17 UIKit 0x00078c90 -[UIRuntimeConnection initWithCoder:] + 152
18 Foundation 0x000566c6 _decodeObjectBinary + 1066
19 Foundation 0x000571ec -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1128
20 Foundation 0x0004f486 -[NSArray(NSArray) initWithCoder:] + 334
21 Foundation 0x000566c6 _decodeObjectBinary + 1066
22 Foundation 0x00056230 _decodeObject + 196
23 Foundation 0x000560fc -[NSKeyedUnarchiver decodeObjectForKey:] + 60
24 UIKit 0x00075954 -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:] + 636
25 UIKit 0x00075558 -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:] + 104
26 UIKit 0x00004c00 -[UIApplication _loadMainNibFile] + 136
27 UIKit 0x00004880 -[UIApplication _runWithURL:sourceBundleID:] + 96
28 UIKit 0x00055df8 -[UIApplication handleEvent:withNewEvent:] + 1516
29 UIKit 0x00055634 -[UIApplication sendEvent:] + 60
30 UIKit 0x0005508c _UIApplicationHandleEvent + 4528
31 GraphicsServices 0x000057dc PurpleEventCallback + 1044
32 CoreFoundation 0x00057524 CFRunLoopRunSpecific + 2296
33 CoreFoundation 0x00056c18 CFRunLoopRunInMode + 44
34 UIKit 0x00003c00 -[UIApplication _run] + 512
35 UIKit 0x00002228 UIApplicationMain + 960
36 uPasswords 0x00002e04 main (main.m:14)
37 uPasswords 0x00002dd4 start + 32
What I see is simple: in the call stack, you can see the application crashes in UIKit (line 12), exactly while setting up the Tabbar items. At this stage, my application is still being prepared for execution with NIB loading... my code in app delegate is still not even executing. So, I thought: this could be another cause of having to rebuild the application by cleaning all the targets.
Cleaning all targets, rebuilding and installing again this adhoc release fixed my problem. The application is working as expected in french just like the english version.
SIGABRT crashes can be VERY hard to solve but sometimes they can be VERY easy to fix too. This was the case this time. You can read another post that I wrote a few months ago on the subject of application startup crashes:
App startup crash: finding the root cause.
Reader Comments