iHello
unread,Oct 8, 2009, 8:52:47 AM10/8/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to LiquidGear
I use tabBar and when I start my app it sometimes crashes (sometimes
showing 2 tabs instead 3):
Interval Since Last Report: 114379 sec
Crashes Since Last Report: 25
Per-App Interval Since Last Report: 0 sec
Per-App Crashes Since Last Report: 20
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread: 0
Application Specific Information:
iPhone Simulator 3.0 (138), iPhone OS 3.0 (7A341)
*** Terminating app due to uncaught exception 'NSRangeException',
reason: '*** -[NSCFArray insertObject:atIndex:]: index (1) beyond
bounds (1)'
Thread 0 Crashed:
0 CoreFoundation 0x302ac924
___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ + 4
1 libobjc.A.dylib 0x94045e3b
objc_exception_throw +
40
2 CoreFoundation 0x3028e5fb +[NSException
raise:format:arguments:] + 155
3 CoreFoundation 0x3028e55a +[NSException
raise:format:] + 58
4 Foundation 0x305684e9
_NSArrayRaiseBoundException + 121
5 Foundation 0x30505b05 -[NSCFArray
insertObject:atIndex:] + 85
...................
I think problem here:
- (void)addTab:(int)num title:(NSString *)title icon:(NSString *)icon
callback:(NSString *)callback {
NSDictionary *tabObj = [NSDictionary
dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"%d", num], @"num",
title, @"title",
icon, @"icon",
callback, @"callback",
nil
];
[tabButtons insertObject:tabObj atIndex:num-1];
if(num > 0 && num <= 5 && [tabButtons count] > 0) {
[self resetTabs];
}
}
- (void)removeTab:(int)num {
if(num <= [tabButtons count] && num-1 > 0) {
[tabButtons removeObjectAtIndex:num-1];
[self resetTabs];
}