What I want to do is to have several sections in a table. Each section stores individual addresses. The last section is used to add personal addresses. If the number of addresses reaches 5, the section of the last added address is not displayed. The number of sections is given as follows: [plain] return [self. addsArray count] <5? [Self. addsArray count] + 1: [self. addsArray count. This error indicates that there are five sections before deletion, and the number of sections remains unchanged after deletion (because I need to reproduce the section with the new address, the number of sections remains unchanged ). This is a conflict, so xcode reported an error to me. My solution is: define a local variable sectionCount. When no delete operation is performed, the number of this variable is [plain] [self. addsArray count] <5? [Self. addsArray count] + 1: [self. addsArray count]; The delete operation is like this: [plain] BOOL success = [[DataCenter singleton] deleteAddressFromeDB: userAdds. user_id withAddressId: userAdds. address_id]; [self. addsArray removeObjectAtIndex: deleteSection]; sectionCount = [self. addsArray count]; [addressTable deleteSections: [NSIndexSet indexSetWithIndex: deleteSection] withRowAnimation: UITableViewRowAnimationFade]; sec TionCount = sectionCount + 1; [addressTable reloadData]; that is: 1. delete the data source, and then delete section. 2. add a section (Add a new address) and refresh the interface. This will solve this problem. II. The problem of EXC_BAD_ACCESS is estimated to be sufficient for beginners. This crash is most likely caused by excessive release, but it cannot be seen from the printed information. Here is a common method, for example (different xcode versions may have different locations, I used version 4.5.): --> (check Enable Zombie Objects)
Run the command again and you will see the following print information: