除非我不在意,否则这在iOS4上运行正常。我更新到iOS5,现在它在[indexPath section]
上抛出了这个错误的访问错误。它位于UITableView
:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Get the cell label and value NSLog(@"section: %@", [indexPath section]); /* BAD ACCESS ERROR HERE */ ...
答案 0 :(得分:4)
日志语句本身导致错误。
NSLog(@"section: %@", [indexPath section]); /* BAD ACCESS ERROR HERE */
您正在尝试记录一个整数,就好像它是一个对象一样。它应该是:
NSLog(@"section: %i", [indexPath section]);