iOS Development----Development Error Summary and resolution

Source: Internet
Author: User

This article reprinted to http://blog.csdn.net/shenjx1225/article/details/8561695

One, today debugging the program, there was a crash, the information is as follows:

2013-02-01 09:05:23.929 SD4IPHONE[627:C07] * * * terminating app due to uncaught exception '  Nsinternalinconsistencyexception ', Reason: ' Invalid update:invalid number of sections. The number of sections contained in the table view after the update (5) must is equal to the number of sections contained In the table view before the update (5), plus or minus the number of sections inserted or deleted (0 inserted, 1 deleted). ‘

First throw Call stack:

(0x2424052 0x961d0a 0x23cca78 0x14822db 0x18d4257 0x18df518 0x18df593 0x9699b58 0x12111 0x2425e72 0x14119ef 0x23f897f 0x23 5bb73 0x235b454 0x235adb4 0X235ACCB 0x2801879 0x280193e 0x1850a9b 0x20c22 0x2a05)

Terminate called throwing an exception (LLDB)

What I'm going to do is a table with several sections, each with a one-person address, and the last section to add a personal address, if the number of addresses reaches 5, then the last section to add a new address does not appear.

The previous section number is given this way:

[Plain]View Plaincopy
    1. return [Self.addsarray count]<5? [Self.addsarray Count] + 1: [Self.addsarray count];


Delete the data source at the time of deletion, and then do the delete list refresh interface operation, but this will report the error as above.

This error means: I deleted 5 sections before deletion, the number of sections is unchanged (because I need to reproduce add new address this section will cause the number of sections unchanged). This is contradictory, so Xcode gave me an error.

My solution is: Define a local variable sectioncount, when not deleted, its number is

[Plain]View Plaincopy
    1. [Self.addsarray count]<5? [Self.addsarray Count] + 1: [Self.addsarray count];


This is the case when you delete an operation:

[Plain]View Plaincopy
  1. BOOL success = [[DataCenter Singleton] deleteAddressFromeDB:userAdds.user_id
  2. WITHADDRESSID:USERADDS.ADDRESS_ID];
  3. [Self.addsarray removeobjectatindex:deletesection];
  4. Sectioncount = [Self.addsarray count];
  5. [Addresstable Deletesections:[nsindexset Indexsetwithindex:deletesection]
  6. Withrowanimation:uitableviewrowanimationfade];
  7. Sectioncount = sectioncount+1;
  8. [Addresstable Reloaddata];


In summary: 1. Delete the data source first, then delete the section operation, 2. Add another section (adding a new address), and then refresh the interface. This will solve the problem.

Second, exc_bad_access

For beginners, this problem is estimated to be enough for dt. This crash is probably the most likely cause of over-release, but from the printed information can not be seen, here is a common method I used, such as (the Xcode version, the location may be different, I use the 4.5 version):

--(Hook on enable Zombie Objects)

Then run again and you can see the print information like this:

You can see that a table should be over-released (if you're lucky, you'll point to the line you crashed in the code), and then go to the table where it's over-released, so the problem is solved. (Of course, this method is not the hundred test lark, and sometimes you have to follow up, debugging)

Third, Undefined symbols for architecture i386:

Workaround: http://blog.csdn.net/azhou_hui/article/details/18312047

Iv. Local declaration of ' xxx ' hides instance variable

This is caused by defining a local variable with the same name as the member variable, as long as the name of the local variable or member variable is modified.

V.-[__nsarraym respondstoselector:]: Message sent to deallocated instance 0xfe8afb0

The message is sent to an object that has been disposed of, that is, the object you are using has been freed, check the memory management of the object.

***

VI, unbalanced calls to begin/end appearance transitions for <uiviewcontroller:0x1111fec0>.

Find the place where the problem occurred:

[Plain]View Plaincopy
    1. 1. id pp = [VC performselector: @selector (Presentingcontroller)];
    2. 2. [pp Presentmodalviewcontroller:nav animated:yes];


In the first line of code, the animation in the Presentingcontroller method has not been completed, and the second line begins, which leads to the above problem. One way to solve a similar problem is to have the first animation complete before performing the next animation.

Vii. Direct access to Objective-c's Isa is deprecated in favor of Object_setclass () and Object_getclass ()

In the jsonkit of Xcode 4.6 hit the above warning, Google down, there are the following two solutions:

Object->isa = xxx; Replace with Object_setclass (object,xxx), or Object_getclass (object) = XXX;

Eight, the simulator film display, the real machine does not display

There are two possible reasons:

1. Image non-PNG format

2. Picture name capitalization problem, simulator is case-insensitive, true machine differentiated

(Just learn, if there are other possibilities, welcome to add)

Nine, first run crash, second normal

Workaround:

Replace the debugger lldb with GDB

Steps:

The new version of Xcode (after 4.3) of the debugger, the default is to use LLDB, it is said ll this set is a more advanced versions.
But Xcode seems to have a variety of problems. For example, the breakpoint has been removed and is still broken there.
If patience, you can use GDB instead.

Product->edit scheme-> Run Xxx.app (TargetName), Info, Debugger select GDB

X. Warning:no rule to process file ' $ (project_dir)/photo/selectfiledetailvc.h ' of type sourcecode.c.h for architecture arm V7

Find "Build phases" (don't know where to look at the third question, there are steps), delete the "SelectFileDetailVC.h" this file can be.

Xi. unbalanced calls to begin/end appearance transitions for <uivewcontroller>

The problem is that the last animation is not over, and the next animation starts, causing it.

Here's a workaround: http://www.kaifajie.cn/ios/9413.html

12, ASIHTTPRequest Class Library in iOS 7.0 (this is the turn, but I found that iOS6 will also have a warning), there will be some error warning, need to make a minor change:


1.
if ([inputstream streamstatus] = = nsstreameventerroroccurred) {


Modified to:
if ([inputstream streamstatus] = = (nsstreamstatus) nsstreameventerroroccurred) {




2.
return [[NSDate Date] addtimeinterval:maxage];


Modified to:
return [[NSDate Date] datebyaddingtimeinterval:maxage];

13, xcode4.5 Real machine debugging problems:

The following information is indicated:
Xcode cannot run using the selected device.

Choose a destination with a supported architecture in order to run the this device.

1, suspicion of the certificate has a problem. But it hasn't been found for a long time.

2. Start to suspect iOS version issue. The iOS version of the real machine is ios5.1. xcode4.5 is for the latest version of IOS6. However, the previous Xcode version will prompt Xcode to not support the version of your existing device. It is recommended that you download this version of the iOS debug package. But this time there is no such hint.
I also linked to Xcode with a 4.1 version of the device. This is a hint that Xcode only supports versions of iOS 4.3, 5.0, 5.1, and 6.0. This time excludes the iOS version issue for the device.
At this time can only help the almighty Google. Discover the solution. Http://stackoverflow.com/questions/11673424/xcode-4-4-unable-to-run-project.


It turns out that xcode4.5 now only supports compilation of ARM7 instructions. The existing project settings support both ARM6 and ARM7 compilation. The project is compiled and selected to support only ARM7 can be the real machine debugging. According to the Post, xcode4.5 compiled program can only run in ios4.3 above the system. If you want to be compatible with older versions, you need to use the older version of Xcode compilation. (There may be another solution, not to be studied for the time being)

14. (Format ten, created by Subversion 1.6)

Original link: http://blog.csdn.net/tongzhitao/article/details/18221831

Item, check out with the version tool.

XCODE5 upgraded the relevant thing, there was a problem (format, created by Subversion 1.6).

The reason should be that the version is too old. I checkout the project at the low version. Need to upgrade.

Terminal: SVN upgrade is available.

Related SVN tools also need to be upgraded

15, "Library not found for-" solution

Workaround: http://lizi464789754.blog.163.com/blog/static/168937085201411134123538/

Cond...

iOS Development----Development Error Summary and resolution

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.