in app habe ich benutzerdefinierte tableview(UITableView *tableView)
die Unterklasse von Uiviewcontroller & in Tableview Bearbeitung zeigen perfekt ist, aber wenn ich Zeile löschentableview Bearbeitung Crash-Anwendung in iPhone?
- (void)tableView:(UITableView *)tableView1 commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
//[appDelegate deleteItemAtIndexPath:indexPath];
[self testing:indexPath];
[tableView deleteRowsAtIndexPaths:
[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];//in this line app crash
NSLog(@"delete row");
[tableView reloadData];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
//nothing to do item already added
}
}
in diesem Verfahren, wenn Unterbrechungspunkt geht an dieser Linie
[tableView deleteRowsAtIndexPaths: [NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
mein Absturz was ich tue, um daraus zu kommen.
- (void) Prüfung: (NSIndexPath *) Wegs {
Player *doc = [[Player alloc]init];
NSMutableArray* reversedArray = [[NSMutableArray alloc] initWithArray:[[[[NSArray alloc] initWithArray: _data] reverseObjectEnumerator] allObjects]];
doc = [reversedArray objectAtIndex:path.row];
NSLog(@"%@,%d", doc.name,path.row);
[self deleteRow:doc];
}
- (void) deleteRow: (Player *) doc {
// ReferMeAppDelegate * AppDelegate = (ReferMeAppDelegate *) [[UIApplication sharedApplication] Delegat]; self.party = [PartyParser ladenParty]; if (_party! = Nil) { für (Player * player in _party.players) { NSLog (@ "% @,% @", player.name, player.alert); NSComparisonResult resultName, resultEmail, resultPhone, resultLocation; // NSString * str = [appDelegate.plistDict valueForKey: @ "flag"]; // if ([player.email länge]! = 0 & & player.alert == @ "1") { resultName = [dok.name vergleichen: spieler.name]; resultEmail = [doc.email vergleichen: player.email]; resultPhone = [doc.phone vergleichen: player.phone]; resultLocation = [doc.location compare: player.location]; if (resultName == 0 & & resultEmail == 0 & & resultPhone == 0 & & resultLocation == 0) { //lblName1.text = @ "gleich"; Player * playerr = [[Spielerzuweisung] init]; Spieler = Spieler; [_party.players removeObject: player]; //[_party.players removeObjectAtIndex: path.row]; Pause; } //} //if([player.email Länge] == 0 & & player.alert == @ "2") { else { resultName = [doc.name vergleichen: player.name]; resultPhone = [doc.phone vergleichen: player.phone]; if (resultName == 0 & & resultPhone == 0) { Spieler * playerr = [[Player alloc] init]; Spieler = Spieler; [_party.players removeObject: player]; Pause;
} } }
for (Player *player in _party.players) {
NSLog(@"after match case player names");
NSLog(@"%@", player.name);
}
[PartyParser saveParty:_party];
}
}
I GData xml in app bin mit der & Schreibleseoperationen unterstützen.
was ist das Crash-Log auf der Konsole? – Swastik
*** Beenden der App aufgrund der nicht abgefangenen Ausnahme 'NSInternalInconsistencyException', Grund: 'Ungültige Aktualisierung: ungültige Anzahl der Zeilen in Abschnitt 0. Die Anzahl der in einem vorhandenen Abschnitt enthaltenen Zeilen nach der Aktualisierung (1) muss der Anzahl von entsprechen Zeilen, die in diesem Abschnitt vor der Aktualisierung enthalten sind (1), plus oder minus der Anzahl der Zeilen, die in diesem Abschnitt eingefügt oder gelöscht wurden (0 eingefügt, 1 gelöscht). " 2010-12-09 14: 04: 01.478 ReferMe [29684: 207] Stack: –