Search code examples
iosobjective-cios6

Lack of understanding crash report


I have this crash report.

Incident Identifier: CA9E350A-C842-4349-AAD8-E9E62E93BDD1
CrashReporter Key:   360bc129d2f79a48e291eb5ca38b24e822ed5b6b
Hardware Model:      xxx
Process:         OrientalDailyiOS [1502]
Path:            /var/mobile/Applications/39480A57-68FF-4C46-8445-340EFE204119/OrientalDailyiOS.app/OrientalDailyiOS
Identifier:      OrientalDailyiOS
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2012-10-14 15:49:10.884 -0700
OS Version:      iOS 6.0 (10A403)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x37a0a29e __exceptionPreprocess + 158
1   libobjc.A.dylib                 0x34e3197a objc_exception_throw + 26
2   CoreFoundation                  0x37955b70 -[__NSArrayM objectAtIndex:] + 160
3   OrientalDailyiOS                0x00064fdc -[Main_NewsDetail viewDidLoad] (Main_NewsDetail.m:43)
4   UIKit                           0x386cb590 -[UIViewController loadViewIfRequired] + 360
5   UIKit                           0x38757336 -[UIViewController shouldAutorotate] + 22
6   UIKit                           0x38798cd4 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1540
7   UIKit                           0x38797fca -[UIViewController presentViewController:withTransition:completion:] + 3390
8   UIKit                           0x388ba252 -[UIViewController presentModalViewController:animated:] + 26
9   Foundation                      0x34364a6a __NSFireDelayedPerform + 446
10  CoreFoundation                  0x379df5da __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 10
11  CoreFoundation                  0x379df28c __CFRunLoopDoTimer + 268
12  CoreFoundation                  0x379ddefc __CFRunLoopRun + 1228
13  CoreFoundation                  0x37950eb8 0x37948000 + 36536
14  CoreFoundation                  0x37950d44 CFRunLoopRunInMode + 100
15  GraphicsServices                0x373e32e6 GSEventRunModal + 70
16  UIKit                           0x387002fc 0x386a9000 + 357116
17  OrientalDailyiOS                0x0005fac2 main (main.m:16)
18  OrientalDailyiOS                0x0005fa84 0x5e000 + 6788

However, I couldn't know where is error, I play around with my apps but show no error.

I also tried iOS 6 with iPad, no problem.

what apple feedback was

We found that your app crashed on iPad running iOS 6, which is not in compliance with the App Store Review Guidelines.

Your app crashed on both Wi-Fi and cellular networks when we:

1. Launch the app.
2. Tap any item on main page.
3. App crashes.

Update

Main_NewDetails

- (void)viewDidLoad
{
[super viewDidLoad];
[slider setHidden:YES];
DatabaseAction *getnews = [[[DatabaseAction alloc] init] autorelease];
self.singlenews = [getnews retrieveSingleNews:newsid];
self.defaultsize = [getnews retrieveFont];
font = [self.defaultsize objectAtIndex:0];
currentsize = font.Font_Size;
News *new = [self.singlenews objectAtIndex:0];
if(self.catsid != 10)
    self.header.text = new.News_Cat_Name;
else
    self.header.text = @"評論";
self.title.text = new.News_Title;
authortext = new.News_Author;
self.content.text = [NSString stringWithFormat: @"%@%@", new.News_IntroText,  new.News_FullText];
self.introtext = new.News_IntroText;
self.content.font = [UIFont systemFontOfSize:currentsize];
self.date.text = new.News_ArticalDate;
self.commentno.text = @"留言: 0";
imagepath = new.News_ImagePath;
onetime = YES;

if([Constant_Config NetworkStatus]){
    if(![imagepath isEqualToString:@"no picture"]){
        NSOperationQueue *queue = [NSOperationQueue new];
        NSInvocationOperation *operation = [[NSInvocationOperation alloc]
                                            initWithTarget:self
                                            selector:@selector(loadImage)
                                            object:nil];
        [queue addOperation:operation];
        [operation release];
    }

    NetworkHandler *networkHandler=[[NetworkHandler alloc] init];
    GetTotalCommentsRequest *gettotalcomments= [[GetTotalCommentsRequest alloc] init:newsid];

    [networkHandler setDelegate:self];
    [networkHandler request:gettotalcomments];
    [gettotalcomments release];
    [networkHandler release];

    [self.scrollView addSubview:[self addbanner]];
    [self.scrollView addSubview:[self addbanner]];
}

[self setlabelXY];

AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
[appDelegate openSessionWithAllowLoginUI:NO];
}

Solution

  • What you're looking at is a stack trace, the path the program goes through your code. Each line is a function, starting at the main run loop (18) and ending at the crash (0).

    The most useful parts are the functions that you have created in your app OrientalDailyiOS at frame 3.

    Your app is crashing trying to access an object in an NSArray (frame 2) inside your Main_NewsDetail viewDidLoad] method (frame 3).

    Edit

    As I said, your app is crashing trying to access an object in an NSArray. Take a closer look at your application specifically the two lines in your viewDidLoad method that use the method that's crashing above objectAtIndex:.

    font = [self.defaultsize objectAtIndex:0];
    
    News *new = [self.singlenews objectAtIndex:0];
    

    How are you populating self.singlenews ? What is the case were it could have no objects?