开发者

Iphone app wont run after upgrading to iOS 4.2

开发者 https://www.devze.com 2023-02-11 05:44 出处:网络
After installing Xcode 3.2.5 iOS 4.2 an app that was perfectly working stopped working.I have seen that this has happened to others but cant understand how to solve it.

After installing Xcode 3.2.5 iOS 4.2 an app that was perfectly working stopped working. I have seen that this has happened to others but cant understand how to solve it.

My questions are: 1. How can I know where it is crashing? 2. What can I do to better debug and pinpoint the problem.

Here is the call stack.

Iphone app wont run after upgrading to iOS 4.2

Tommy thanks for the answer. I have build and run and suggested but when it crashes it does not show开发者_StackOverflow中文版s where it crashed. Also I added a breakpoint inside the method but it does not stops there. Any further ideas? Here is the code snippet.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
ApplicationData *appdata = [ApplicationData sharedInstance];
if(appdata.currentCategoryIndex >= 0) {
    Category *category = [appdata.categoryList objectAtIndex:appdata.currentCategoryIndex];
    if(category.records) {
        [lab_norecords setHidden:YES];
    } else {
        [lab_norecords setHidden:NO];
        return 0;
    }
    return [category.records count];
}
return 0;

}

Iphone app wont run after upgrading to iOS 4.2

Now I am getting this error:

Iphone app wont run after upgrading to iOS 4.2

I believe the source of the problem is here in the same subCategoryView:

- (id)init {
if([[NSBundle mainBundle] loadNibNamed:@"SubCategoryView" owner:self options:nil]) {
    //if(self = [super initWit])
    cellowner = [[TableCellOwner alloc] init];
    [listTableView setBackgroundColor:[UIColor clearColor]];
    [listTableView setSeparatorColor:[UIColor whiteColor]];
    [listTableView initialize];
}
return self;

}


From the trace you've got, check out the second column. The most recent thing in your application was a call to SubCategoryView numberOfSectionsInTableView:, in the fourth row (the one numbered '3'). The triggered exception was NSRangeException, where you attempted to retrieved object 4294967295 from an array with 22 objects in it. 4294967295 is how -1 looks if you cast a signed 32bit number to an unsigned number, so for some reason you're doing something like:

NSInteger variable = -1;
[array objectAtIndex:variable];

Somewhere within SubCategoryView's numberOfSectionsInTableView. Best immediate guess: some change between 4.1 and 4.2 is causing whatever method you use to populate the table to come up with the wrong results.

To advance from here, make sure you're doing a debug build and launch with command+y (or go to Build, Build and Run - Breakpoints On). When your program crashes this time the debugging window should appear, showing you exactly the line your program throws an exception at and allowing you to inspect the state of all your program variables at that point. The debugger will also allow you to place breakpoints, step through your program one line at a time and all the other usual things.

0

精彩评论

暂无评论...
验证码 换一张
取 消