This article is based on the source text to do the collation: http://www.devdiv.com/home.php?mod=space&uid=50901&do=blog&id=50856
Xcode version 7.1 iOS version 9.1
An app that was previously developed by the company, after upgrading to 9.0 in the iOS version of the environment, an action can cause the program to flash back.
Error prompting in Xcode code:
Thread 1:program received signal: "Exc_bad_access"
Such a hint means sending a message to an object that has already been disposed, or calling release on an object that cannot be released.
By default, Xcode does not pinpoint the exact line of code that is causing the problem.
Let's set up the development environment first
First open the Debug Console view interface, allowing Xcode to output more information when debugging: Menu Xcode > Preferences
Set the environment variable again: Menu product > Scheme > Edit scheme
After setting up the debugger, a message sent to deallocated instance error log is found in the output interface
In previous versions of Xcode, we could use info malloc-history 0x6d564f0 in the Xcode console view to see the call stack to see where the crash occurred.
In the new Xcode, the debugger uses the LLDB by default, so how do you locate crash in Lldb state due to improper memory operation?
Open Activity Monitor and find the process number PID for the test app in the list of processes (Xcode will find the app's process in the list of processes when debugging is enabled)
Now we have two main messages:
App Process id:1087
Crash Address: 0X7F7F7523FF10
Open terminal and enter the following command:
1087 0X7F7F7523FF10
Get the error log so that you can locate the line of code that was last called
Downloadbtns is our custom method of releasing the newly built UIButton within this method, which is the culprit that caused the crash.
[BTN release];
Resolve message sent to deallocated instance error in LLDB mode