升级到iOS 4.2后,Iphone应用程序无法运行

时间:2011-02-17 13:19:10

标签: xcode ios4

安装Xcode 3.2.5 iOS 4.2之后,完美工作的应用程序停止工作。我已经看到这发生在其他人身上但却无法理解如何解决它。

我的问题是: 1.我怎么知道它在哪里崩溃? 2.我能做些什么来更好地调试和查明问题。

这是调用堆栈。

Call Stack

汤米谢谢你的回答。我已经构建并运行并建议但是当它崩溃时它没有显示它崩溃的地方。我还在方法中添加了一个断点,但它并没有停在那里。还有什么想法?这是代码段。

- (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;

}

enter image description here

现在我收到了这个错误:

enter image description here

我认为问题的根源在同一个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;

}

1 个答案:

答案 0 :(得分:3)

从你的踪迹中,看看第二栏。您应用程序中最新的事情是在第四行(编号为'3'的那一行)中调用SubCategoryView numberOfSectionsInTableView:。触发的异常是NSRangeException,您尝试从包含22个对象的数组中检索对象4294967295。 4294967295是-1看起来如果你将一个有符号的32位数字转换为无符号数字,所以出于某种原因你做了类似的事情:

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

SubCategoryView的numberOfSectionsInTableView中的某个地方。最直接的猜测:4.1和4.2之间的一些变化导致您使用任何方法填充表格以得出错误的结果。

要从这里开始,请确保您正在进行调试构建并使用命令+ y启动(或者转到构建,构建和运行 - 断点开启)。当程序崩溃时,应该出现调试窗口,显示程序引发异常的行,并允许您检查该点上所有程序变量的状态。调试器还允许您放置断点,一次一行地执行您的程序以及所有其他常见的事情。