Ios q & A series-differences between xcode release and debug modes

Source: Internet
Author: User
========================================================== =============================== Original blog, reprinted please declare the source of Electronic coffee (original id blue rock) ========================================================== ================================

There is no problem with the company's applications in the local test. Therefore, the application is submitted to the app store. After the application is approved, let's take a look at it and find a crash. Go back to your Mac for breakpoint debugging. Normal. After thinking for a moment, I think that my local development is in the debug mode, while the App Store is in the release mode. is the difference between the two? So I switched to the release mode and re-run the task (for example, switch mode). An error is returned. Okay, click the breakpoint to find the reason. It is found that the log of the power failure is not printed, and the memory is also messy, crazy. So I began to think about the differences between debug and release in IOS.

Release is the release version, which is somewhat optimized than the debug version. The file is smaller than the debug file. debug and release call two different underlying libraries.
I. "Debug is a debugging version, includingProgramMore information"
2. Only debug programs can set breakpoint, single-step execution, and debug output statements using trace/assert.
3. realbench does not contain any debugging information, so it is small in size and runs fast.

Let's talk about the error I encountered this time:

CodeIt is a loop. The error occurs because the array is out of bounds.

Int emojirangearray [12] = {100,104, 20, 30, 40, 50, 60, 70, 80, 90,}; For (Int J = 0; j <12; j ++) {int startindex = emojirangearray [J]; int endindex = emojirangearray [J + 1]; // [1]. The maximum value of J is 11, so J + 1 is 12, printf ("showemojiview --- startindex: % d, endindex: % d \ n", startindex, endindex); For (INT I = startindex; I <= endindex; I ++) {// [2]. The value provided here is incorrect because the above is out of bounds. Therefore, the internal nsarray objectatindex is out of bounds.

However, in debug, emojirangearray [12] = 12, which is smaller than startindex, where the condition [2] does not match, the loop ends, and no exception is triggered.

However, in release, emojirangearray [12] = 1094795585 (the memory address should be), which is greater than startindex. If the conditions at [2] are met, the loop continues and exception is triggered.

I will continue to record the differences between release and Debug. Let's write it here today. It's off duty. It's a long-time break.

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.