Questions tagged [exc-bad-access]

EXC_BAD_ACCESS is a fatal error related to memory management on macOS and iOS.

This is a kind of crash that occurs when a program tries to access memory (including, but by no means limited to, Objective-C objects) that it has deallocated or had never allocated in the first place.

The correct name is EXC_BAD_ACCESS, not EXEC; the “EXC” stands for “exception”, specifically a Mach kernel exception (meaning that the kernel did not like what your process did; this is not the same as a kernel panic). This isn't a C++ or Objective-C exception, so there's no catching it.

EXC_BAD_ACCESS means that you've freed or released an object and then tried to use it later, or failed to retain an object that you planned to use again later.

To prevent this error from happening:

  • Practice good memory management
  • Run the static analyzer in Xcode to find bugs
  • Run Instruments with the Zombies template to find premature-object-death bugs
2059 questions
0
votes
2 answers

Objective-C error EXC_BAD_ACCESS help please

I am currently using the pragmatic screencast on Objective-C to help me program in objective-c. I have a background in Java and C++, but I am having a very difficult time getting used to everything in Objective(Mostly because I am not comfortable…
seanb511
  • 3
  • 2
0
votes
2 answers

EXC_BAD_ACCESS after calling popViewControllerAnimated

I'm getting an EXC_BAD_ACCESS after calling dismissModalViewControllerAnimated on my view controller. My project is based on the table view starter project, and RootViewController creates a view like this: GobanVC *vc = [[GobanVC alloc]…
TimK
  • 7,438
  • 10
  • 40
  • 47
0
votes
1 answer

SpriteKit Obj C game crashes in iOS 9

I have a game using sprite kit and objective-C originally developed using Xcode 6 and iOS 7, but it now crashes on iOS 9 devices. The crash occurs when the user is progressing from one level to another and a new horizontal scrolling background…
dancingbush
  • 2,131
  • 5
  • 30
  • 66
0
votes
1 answer

Realm EXC_BAD_ACCESS after using new notification functions from from 0.98.0

During delete object from realm I write transaction in main thread. And I have list observer that uses new api from 0.98.0 addNotificationBlock Please can you assist why this EXC_BAD_ACCESS happens, and how to prevent it. Is there any restriction…
Igor Palaguta
  • 3,579
  • 2
  • 20
  • 32
0
votes
0 answers

EXC_BAD_ACCESS - Random AND Incomprehensible

I knew EXC_BAD_ACCESS & Zombie, and how to find it in normal way. But what I face now is very very confusing, at least to me. Background I have a multi-account app, in which the user can login many accounts at the same time. The app works well with…
Jason Lee
  • 3,200
  • 1
  • 34
  • 71
0
votes
0 answers

SCNParticleSystem subclass with custom property causes crash

If I subclass SCNParticleSystem and add a property to the custom subclass, and assign a value to the property. SceneKit will crash on Mac. But it works on iOS and tvOS! The crash always occurs when the particle systems emitter shape is being…
StackUnderflow
  • 2,403
  • 2
  • 21
  • 28
0
votes
0 answers

how to debug crash on iphone for javascript app

I am new to performance and memory leaks in JavaScript and wkwebview. How to find the memory leak in JavaScript app that runs on iPhone? My app crashes with exception EXEC_BAD_ACCESS (SIGSEGV), subtype- (KERN_INVALID_ADDRESS).
0
votes
2 answers

Releasing reference to UIApplication's delegate results in EXC BAD ACCESS, why?

I am running my application through xcode's static analyzer and it pointed out that I had a potential leak in a file: MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; So after the code I do [delegate…
Chris James
  • 11,571
  • 11
  • 61
  • 89
0
votes
0 answers

NSManagedObjectContext crash (EXC_BAD_ACCESS) but sure it can't be my fault

I've just got a crash through when running with Xcode and I'm pretty sure there's no way it's my fault. How can there be a bad access error? fetch is created right before it so it must exist in memory, and self is the context itself (this method…
Sencha
  • 415
  • 3
  • 12
0
votes
2 answers

Strange output when trying to access data

I have a data structure object which is loaded from an XML file inside the "did finish loading" method of the delegate. If I use the data objects "printData" method from inside the load method of the delegate it shows all the info. I can do this…
Fogmeister
  • 76,236
  • 42
  • 207
  • 306
0
votes
3 answers

EXC_BAD_ACCESS with iPhone SDK UINavigationController

Okay so I am trying to use a simple UINavigationController with iPhone SDK in Xcode and it works all well when pushing but if go past 2 pushes and try to pop the view controllers I keep getting the error: EXC_BAD_ACCESS I know what it means but how…
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
0
votes
0 answers

EXC_BAD_ACCESS just crash on arm64 when run nestopia project with xcode 7

The nestopia project url:https://github.com/jzdziarski/nestopia When I download and run it on an 32bit iOS Device, it works well.(not include arm64). But when I run it on arm64 IOS Device, it crashes :EXC_BAD_ACCESS. It crashes at this point: void…
0
votes
1 answer

Parse Subclass Instance Method EXC_BAD_INSTRUCTION

When subclassing from a parse user object PFUser, I get bad-instruction errors when using my own methods. Do you guys have any thoughts on why this is happening User.swift import UIKit import Parse class User: PFUser { // Instance Variables …
0
votes
1 answer

Need help debugging a crash in my SpriteKit app

If I click to go to another scene then my app crashes.
user5696262
0
votes
1 answer

EXC_BAD_ACCESS Error while using an array

I need help with figuring out what exactly is this error and why is it occuring. When I debud the program everything seems to be working perfectly fine! I do not get this. Code: void WordsRandom() { srand((unsigned)time(NULL)); n = rand() %…