FAQ Database Discussion Community


Why does the argument ioNumBytes of AudioFileReadPacketData cause a crash?

ios,core-audio,exc-bad-access,audioqueue
I have got something really strange (at least for me but I am a noob). UInt32 numBytesReadFromFile; OSStatus err = AudioFileReadPacketData( audioFile, // The audio file whose audio packets you want to read. NO, // is cache set? &numBytesReadFromFile, // On output, the number of bytes of audio data that...

EXC_BAD_ACCESS when loading UIImage in Swift

swift,uiimage,exc-bad-access,iso
I'm quite new to the iOS platform, but am already an experimented Android dev. I'm experiencing a weird issue in Swift, we cannot reproduce in Objectice-C. We are designing our interfaces by hand, without using the Interface Builder, to have more flexibility. We are getting a EXC_BAD_ACCESS on the mentioned...

Prevent Objective-C object called from C++ code being released

c++,ios,exc-bad-access,audioqueueservices
Here is my situation: I'm using Audio Queue Services in order to record sound. When the callback function is called (as soon as the buffer is full), I send the buffer content to an objective-C object to process it. void AQRecorder::MyInputBufferHandler(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, const AudioTimeStamp *...

swift error exc_bad_access loading image using iboutlet

xcode,swift,exc-bad-access
I'm new in iOS-programming. I tried the following. I created a custom class for a button (source founded on internet) like. class CustomButton : UIButton { var myAlternateButton:Array<CustomButton>? var downStateImage:String? = "radiobutton_down"{ didSet{ if downStateImage != nil { self.setImage(UIImage(named: downStateImage!), forState: UIControlState.Selected) } } } Now when i try to...

EXC_BAD_ACCESS error in C++ array reverser

c++,arrays,exc-bad-access
Below is a simple program to create an array that is the reverse of the passed array. The code throws the following error at line 6: Thread 1: EXC_BAD_ACCESS (code=1, address=0x7fff0000002c). The program compiles and the logic seems fine. Could someone explain my mistake? void arrayReverser(int array[], int arrayLength) {...

BAD ACCESS after block within a block is called (iOS)

ios,firebase,objective-c-blocks,exc-bad-access
I have a block where I am checking a user's status property from firebase. If the status property is 'free' I want to return from the block, otherwise I want to search for another user and check their status and do so until a 'free' user has been found: void(...

“EXC_BAD_ACCESS” When using an array C++

c++,arrays,exc-bad-access,osx-mountain-lion,xcode5.1
I'm trying to make a sieve function for finding prime numbers. The sieve itself consists of an array who's size is dependent on the input value of the function. Everything is fine for small numbers (<~1000000) but larger input values cause the program to give a "bad access" error when...

why i have exc_bad_access doing cast?

c,exc-bad-access
i am programming in C and i have a problem while casting an int into a char. I am using my mac with Xcode to program c. The code is: int main(){ int t = 2; printf("test %s\n", (char)t); //EXC_BAD_ACCESS return 0; } I tried all I found in many...

bad exception when inserting new entity

ios,exception,core-data,exc-bad-access
I have an exception bad access code 2, when i am inserting new entity in core data. class func createInManagedObjectContext(moc: NSManagedObjectContext, fuel_id: Int, fuel_name: String, price: Double) -> Fuel { var fuel = NSEntityDescription.insertNewObjectForEntityForName("GasStation", inManagedObjectContext: moc) as Fuel //exception - EXC_ARM_BREAKPOINT moc.performBlockAndWait { () -> Void in fuel.fuel_id = fuel_id...

EXC_BAD_ACCESS when creating table view programmatically

ios,uitableview,exc-bad-access
I'm trying to create a view programmatically which will have two views inside of it, one is for searching and the other one is a tableview which will shows photos; But i'm having EXC_BAD_ACCESS error with code=2, all of the controller code is below. I suspected there is an infinite...

Why am I getting EXC BAD ACCESS when I don't use a local variable?

ios,objective-c,exc-bad-access
I have this block of code which reads data from an AudioFileID into a buffer. - (void)handle:(void *)aqData audioQueue:(AudioQueueRef) audioQueue buffer:(AudioQueueBufferRef) buffer { TestViewController *vc = (__bridge TestViewController *)aqData; EDCAudioFile *file = vc.file; UInt32 numPackets = file.numberOfPacketsToRead; UInt32 numBytesReadFromFile; OSStatus err = AudioFileReadPacketData(file.audioFile, NO, &numBytesReadFromFile, vc.mPacketDescs, file.currentPacket, &numPackets, buffer->mAudioData); Everything...

Running a simple action on the childnode of an SKScene causes EXC_BAD_ACCESS in iOS 7.1

ios,sprite-kit,exc-bad-access
Ran across this runtime error while putting the finishing touches on a SpriteKit game I've been developing. Runs fine on iOS 8, but crashes on iOS 7.1 (both simulator AND device). I've created a tiny project which recreates the issue I'm dealing with. It creates a GameScene by unarchiving an...

EXC_BAD_ACCESS when performing a segue to ViewController with a UIWebView?

ios,xcode,swift,uiwebview,exc-bad-access
So I have a setup like this: Where I have a custom code reader view controller, and as soon as it detects a barcode, I want it to segue to another view controller with a label and a UIWebView. So far, it works perfectly with just the label being displayed....

Set NSObject property - EXC_BAD_ACCESS

ios,objective-c,exc-bad-access,nsobject
Process : App is on the home view controller and is requesting data on API to set an NSObject property. The request is processing on a private method. User change the view controller to a second view controller (the request is still processing asynchronously) The second view controller is loaded...

bad access exc_i386_gpflt on CFStreamCreatePairWithSocketToHost

ios,objective-c,sockets,ssl,exc-bad-access
I'm trying to establish TLS connection with my server, but it goes wrong on CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, str, 5555, &readStream, &writeStream); with bad access exc_i386_gpflt. How can I fix it? Full code CFReadStreamRef readStream = NULL; CFWriteStreamRef writeStream = NULL; CFStringRef str = (CFStringRef)"127.0.0.1"; CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, str, 5555, &readStream, &writeStream); if (readStream &&...

Appending PFObject to Array - EXC_BAD_ACCESS

ios,swift,parse.com,exc-bad-access
I am currently using Swift and Parse and have run into an issue which I haven't been able resolve for the past several hours. On a button click, I am attempting to add an Employee object to an Event object's eventAttendee's array. @IBAction func joinEvent(sender: AnyObject) { var employee =...

Unarchiving .sks file in Swift for iOS 7.1

ios,swift,sprite-kit,exc-bad-access
I have an app which loads nicely from an .sks file in iOS 8 using the following extension: class func unarchiveFromFile(file : NSString) -> SKNode? { if let path = NSBundle.mainBundle().pathForResource(file as String, ofType: "sks") { var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)! var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)...

EXC_BAD_ACCESS with NSDictionary/CFDictionaryRef

objective-c,nsdictionary,exc-bad-access
I've got the following piece of code : (it's long) //declarations (in the header) : NSDictionary* batteryRawDict; @property (strong, atomic, readonly) NSDictionary* batteryReport; //this dictionary is, obviously, @synthesize'd case PFSKGroupBattery: { //to get more informations or to subscribe for events about power sources, use the IOPowerSources API if (!firstRunDoneForBattery) {...

Thread 1: EXC_BAD_ACCESS (code=1, address=0x176b)

ios,swift,exc-bad-access
When I try to make a simple app, I get this error: @IBAction func pickButton(sender: UIButton) { numberLabel.text = String(format: "The number is %@", randomNumber) Thread 1: EXC_BAD_ACCESS (code=1, address=0x176b) } Here is the full code: import UIKit class ViewController2: UIViewController { @IBOutlet weak var numberLabel: UILabel! @IBOutlet weak var...

Objective-C: Why do I get an EXC_BAD_ACCESS exception when calling objc_msgSend with a parameter?

ios,objective-c,iphone,ipad,exc-bad-access
I have got some problem while working on my own Button class in Sprite Kit / iOS 7.0. As soon as I try to call back the method with "objc_msgSend" I get the following error: Thread 1: EXC_BAD_ACCESS (code=1, address=0x8) Here's my Button class, where "identifier" is given back to...

Swift - execution was interrupted reason exc_bad_access multidimensional array

ios,arrays,swift,multidimensional-array,exc-bad-access
Learning to write swift code, looking at a multidimensional array, want to iterate through the array, withdraw the math function stored in the second column, and then add its first column value to 4 separate arrays (yet to be created) so at the end I will have 4 arrays, containing...

exc_bad_access when advancing simulation on device

sprite-kit,exc-bad-access,skemitternode
This error only occurs on the actual device. When running on the simulator in Xcode 6, it does not crash. I am creating outer space and have random shooting stars streak across the sky. In the scene, [goToSpace] is called which sets up the starfield by using three SKEmitterNodes to...

C++ exc_bad_access accessing string field from pointed-to object in unordered_map

c++,vector,exc-bad-access,unordered-map
I'm trying to maintain a fast-access vector in the following manner: MyClass.h: class MyClass{ private: std::vector<Stuff> myStuffList; std::tr1::unordered_map<std::string,Stuff*> myStuffListIndex; ... public: void addToStuffList(std::string key,Stuff stuff); }; MyClass.cpp: ... void MyClass::addToStuffList(std::string name, Stuff stuff){ myStuffList.push_back(stuff);//our man is guaranteed to be at tail myStuffListIndex[name] = &myStuffList[myStuffList.size()-1];//store //pointer to object that we just...