Recently, I made some changes to an iOS app. Nothing special, but it was an app originally written for iOS 2.x, and now I had to go through the Xcode 4.x & iOS 5 hoopla. I survived. At least, that is what I thought.
As a result of the whole operation, my app now runs on ANY iOS device, EXCEPT the second generation iPod touch with iOS 4.2.1. (the original version ran fine on any device).
The puzzling (at least to me) part is the following:
- The App runs fine in the debugger. Also after quitting the app, I can just start it, and it will run fine
- If I however make an (ad hoc) archive of the app, save it as an .ipa, and send it to the iPod through iTunes sync, the app starts up, but crashes after a while. The app downloaded from the AppStore behave exactly like that.
I would LOVE to find out what’s going wrong here, but the issue doesn’t occur during debugging.
I have removed the legacy Entitlements.plist, but also played around having the Entitlements.plist around. It didn’t make a difference. (As you might read between the lines, I feel a bit insecure about this part, because I don’t really understand the Entitlements.plist, nor have I ever understood it.)
Also, I made sure, that both on Project and Target level, the iOS Deployment Target is set to 3.2, which is well below the iPod’s OS version. The Base SDK is set to “Latest iOS”.
Finally, I triple-checked that Xcode was up to date.
More than 300.000 people have downloaded my app. According to Flurry, 6.6% have this fatal combination of hard- and software. In the last Version Information in the AppStore, I put out a warning for this issue, but I’d have rather solved it. That is first priority. Understanding the problem would be second.
Please help!
Here is the Device Crash Log (I’m not too familiar with this, so I might post too much):
Incident Identifier: 12DED19E-8BF2-4BE0-A578-4778498D6BE7
CrashReporter Key: 2040f536aa51a5eb273f2d57dd42f748032a4419
Hardware Model: iPod2,1
Process: MyApp [1858]
Path: /var/mobile/Applications/C240F91A-3440-418A-8C6E-C7E6BD75761B/MyApp.app/MyApp
Identifier: MyApp
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-03-04 22:53:37.585 +0100
OS Version: iPhone OS 4.2.1 (8C148)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x32d25ad0 __kill + 8
1 libSystem.B.dylib 0x32d25abe kill + 4
2 libSystem.B.dylib 0x32d25ab2 raise + 10
3 libSystem.B.dylib 0x32d3cd5e abort + 54
4 libstdc++.6.dylib 0x3582fa00 __gnu_cxx::__verbose_terminate_handler() + 588
5 libobjc.A.dylib 0x301888d8 _objc_terminate + 160
6 libstdc++.6.dylib 0x3582d100 __cxxabiv1::__terminate(void (*)()) + 76
7 libstdc++.6.dylib 0x3582d178 std::terminate() + 16
8 libstdc++.6.dylib 0x3582d2a0 __cxa_throw + 100
9 libobjc.A.dylib 0x30186f28 objc_exception_throw + 104
10 CoreFoundation 0x35e9670e -[__NSArrayI objectAtIndex:] + 150
11 MyApp 0x00004932 -[RootViewController setInfo] (RootViewController.m:195)
12 MyApp 0x0000437c -[RootViewController toggleView] (RootViewController.m:90)
13 CoreFoundation 0x35eada3c -[NSObject(NSObject) performSelector:withObject:withObject:] + 20
14 UIKit 0x3384af18 -[UIApplication sendAction:to:from:forEvent:] + 128
15 UIKit 0x3384ae80 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
16 UIKit 0x3384ae48 -[UIControl sendAction:to:forEvent:] + 44
17 UIKit 0x3384aa98 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 528
18 UIKit 0x3384b5c4 -[UIControl touchesEnded:withEvent:] + 452
19 UIKit 0x3383cea8 -[UIWindow _sendTouchesForEvent:] + 580
20 UIKit 0x3383c4dc -[UIWindow sendEvent:] + 388
21 UIKit 0x3381fc94 -[UIApplication sendEvent:] + 444
22 UIKit 0x3381f3ac _UIApplicationHandleEvent + 6816
23 GraphicsServices 0x35262c80 PurpleEventCallback + 1040
24 CoreFoundation 0x35e9a5c4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 22
25 CoreFoundation 0x35e9a582 __CFRunLoopDoSource1 + 158
26 CoreFoundation 0x35e8c82e __CFRunLoopRun + 574
27 CoreFoundation 0x35e8c504 CFRunLoopRunSpecific + 220
28 CoreFoundation 0x35e8c412 CFRunLoopRunInMode + 54
29 GraphicsServices 0x35261d1c GSEventRunModal + 188
30 UIKit 0x33865574 -[UIApplication _run] + 580
31 UIKit 0x33862550 UIApplicationMain + 964
32 MyApp 0x00002ba2 main (main.m:13)
33 MyApp 0x00002b6c 0x1000 + 7020
And here is the SetInfo:
- (void) setInfo {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger theFrame = [defaults integerForKey:@"currentFrame"];
MyAppAppDelegate * myDelegate = (MyAppAppDelegate *)[[UIApplication sharedApplication] delegate];
NSMutableArray * currentCartoons = [myDelegate invert:[myDelegate readPreferences]];
MyAppcartoon * thisCartoon = [currentCartoons objectAtIndex:theFrame];
//format publication & date
NSArray * titlePreSeparator = [thisCartoon.title componentsSeparatedByString:@"("];
if ([titlePreSeparator count]>1) {
NSString * titleSuffix = [titlePreSeparator objectAtIndex:1];
NSArray * titleSeparator = [titleSuffix componentsSeparatedByString:@", "];
NSString * pub = [titleSeparator objectAtIndex:0];
flipsideViewController.Publication.text = pub;
} else {// in case the publication metadata is missing from the rss
flipsideViewController.Publication.text = @"";
}
//format title
NSString * titlePrefix = [titlePreSeparator objectAtIndex:0];
NSArray * titleFixer = [titlePrefix componentsSeparatedByString:@"F&S "];
flipsideViewController.Title.text = [titleFixer objectAtIndex:1];
//format date
flipsideViewController.Date.text = [self formatDatefromrss:thisCartoon.publicationDate];
}
I’m not surprised this code had trouble. There is very little bounds checking in it at all. Though the
objectAtIndex:that stands out to me is:It wouldn’t surprise me if this was line 195 in your source code.