Subject 1: EXC_BAD_ACCESS (code = 1, address = 0x30000008) there was a problem

I have a problem with the application on the simulator. Problem:

EXC_BAD_ACCESS, arising in objc_msgSend in Thread 1.

Screenshot:

enter image description here

In my application, I have several ViewController . when I click the back button of the UINavigationBar , this type of problem occurs, I cannot explain my problem because all functions work correctly.

Example: -

1 - fitstVController (works correctly)

=> it has a UITableView, when I click on a specific row, then it will switch to another UIViewController (SecoundViewController)

2 - SecoundViewController (work correctly)

=> has a UITableView and a UIActionSheet. when I select the UiActionSheet button, then another UIViewController (ThirdViewController) is open

3 - ThirdViewController (working correctly)

=> it has a UITableView and several UIPickerView. But HERE IS A PROBLEM THAT I CAN'T RETURN TO THE PREVIOUS UIViewController (SecoundViewController). => when I do this, then EXC_BAD_ACCESS is generated (Code = 1, address = 0x30000008) .

+4
source share
3 answers

In short, this type of problem occurs when you free the memory allocated for an already released object. Most likely, this type of problem occurs when you return to the previous UIViewController (or other cases).

And also I suggest reading the following link for a more detailed explanation:

Hamster Emporium Archive: So you crashed in objc_msgSend ()

+12
source

Setting an exception checkpoint means that Xcode will stop executing as soon as an exception is thrown. This is not entirely safe, but it usually causes the application to break into a line of code that caused the problem.

This makes it easier to track the source of the problem, although stack tracing is the ultimate way to diagnose problems, often too detailed to be very useful (especially if you, like me, are not an expert compiler.)

To configure this, click on the Breakpoints icon in the Navigator panel and click the + button at the bottom. Then select Add Exception Breakpoint and Objective-C from the list of options.

+4
source

As @TimD rightly pointed out, you can set an exception breakpoint and it will highlight a line of code violation (rather than trying to decrypt the assembler or manually try to determine where the problem is). And, as always, when diagnosing such memory problems, you should always turn on zombies . Finally, it is especially important in non-ARC code that you must run your code through a static analyzer , as many memory problems can be identified there. You should always ensure that you have zero warnings from the static analyzer, as it invariably indicates critical programming errors.

+1
source

Source: https://habr.com/ru/post/1434363/


All Articles