EXC_BAD_ACCESS signal received

前端 未结 30 2728
轮回少年
轮回少年 2020-11-22 06:37

When deploying the application to the device, the program will quit after a few cycles with the following error:

Program received signal: \"EXC_BAD_ACCESS\".         


        
相关标签:
30条回答
  • 2020-11-22 07:12

    This is an excellent thread. Here's my experience: I messed up with the retain/assign keyword on a property declaration. I said:

    @property (nonatomic, assign) IBOutlet UISegmentedControl *choicesControl;
    @property (nonatomic, assign) IBOutlet UISwitch *africaSwitch;
    @property (nonatomic, assign) IBOutlet UISwitch *asiaSwitch;
    

    where I should have said

    @property (nonatomic, retain) IBOutlet UISegmentedControl *choicesControl;
    @property (nonatomic, retain) IBOutlet UISwitch *africaSwitch;
    @property (nonatomic, retain) IBOutlet UISwitch *asiaSwitch;
    
    0 讨论(0)
  • 2020-11-22 07:12

    I realize this was asked some time ago, but after reading this thread, I found the solution for XCode 4.2: Product -> Edit Scheme -> Diagnostics Tab -> Enable Zombie Objects

    Helped me find a message being sent to a deallocated object.

    0 讨论(0)
  • 2020-11-22 07:13

    Just to add

    Lynda.com has a fantastic DVD called

    iPhone SDK Essential Training

    and Chapter 6, Lesson 3 is all about EXEC_BAD_ACCESS and working with Zombies.

    It was great for me to understand, not just the error code but how can I use Zombies to get more info on the released object.

    0 讨论(0)
  • 2020-11-22 07:14

    How To Debug EXC_BAD_ACCESS

    Check out the link above and do as it says.... Just some quick instructions for using NSZombies

    Run the application and after it fails (Should display "Interrupted" rather than "EXC_BAD_ACCESS"... check the Console (Run > Console)... there should be a message there now telling what object it was trying to access.

    -Ben

    0 讨论(0)
  • 2020-11-22 07:14

    To check what the error might be

    Use NSZombieEnabled.

    To activate the NSZombieEnabled facility in your application:

    Choose Project > Edit Active Executable to open the executable Info window. Click Arguments. Click the add (+) button in the “Variables to be set in the environment” section. Enter NSZombieEnabled in the Name column and YES in the Value column. Make sure that the checkmark for the NSZombieEnabled entry is selected.

    I found this answer on iPhoneSDK

    0 讨论(0)
  • 2020-11-22 07:14

    When you have infinite recursion, I think you can also have this error. This was a case for me.

    0 讨论(0)
提交回复
热议问题