IOS development error summary and Solutions

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.