exc-bad-access

UIScrollView EXC_BAD_ACCESS crash in iOS SDK

坚强是说给别人听的谎言 提交于 2019-11-28 18:33:27
问题 I have an iPhone SDK application that has several views that appear and disappear as the user creates content. After using the application on a device for a while, I get the following crash: Program received signal: “EXC_BAD_ACCESS”. (gdb) backtrace #0 0x33369ebc in objc_msgSend () #1 0x320e5248 in -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded] () #2 0x338b4a14 in -[NSObject performSelector:withObject:] () #3 0x320e5098 in -[UIAnimator stopAnimation:] () #4 0x320e4b7c in -

EXC_BAD_ACCESS code 2 on UIAlertView in iOS6

半城伤御伤魂 提交于 2019-11-28 18:09:42
I'm trying to figure out why im getting this crash in my app. It works perfectly fine in Xcode 4.4 running in the simulator with ios5.1, but when i switch into xcode 4.5 and ios6 I'm getting an EXC_BAD_ACCESS code 2. Here is my code: - (void) myMethod { UIAlertView *alertview = [[[UIAlertView alloc]initWithTitle:@"Title" message:@"message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil] autorelease]; alertview.tag = 1 [alertview show]; } this is giving me an EXC_BAD_ACCESS code 2 on the [UIAlertView show] line any ideas? thanks! I've got it. I have the same problem, in my case it

UIWebView EXC_BAD_ACCESS crash

我们两清 提交于 2019-11-28 16:51:59
I'm experiencing crashes of an app that uses UIWebView. Usually it's when page is not fully loaded and UIWebView is sent stopLoading selector. Or when UIWebView fully loaded page. I've got EXC_BAD_ACCESS . Stack looks like this: #0 0x95bb7688 in objc_msgSend #1 0x30a671db in -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] #2 0x3024a10d in __invoking___ #3 0x30249ff8 in -[NSInvocation invoke] #4 0x358ab160 in HandleDelegateSource #5 0x302452c1 in CFRunLoopRunSpecific #6 0x30244628 in CFRunLoopRunInMode #7 0x32044c31 in GSEventRunModal #8 0x32044cf6 in

Adding a delegate to a custom UITableViewCell (bad access error)

£可爱£侵袭症+ 提交于 2019-11-28 11:09:06
I'm trying to add a custom delegate to a custom UITableViewCell of mine. On this cell I have a button which need to fire a method in the ViewController where the UITableView is located on. I'm doing all the usual steps to add a custom delegate but for some reason when I open the VC on runtime the app crashes and gives me a bad access error. When I comment all the delegate code it works properly so my guess is that something is wrong the way I add my delegate. When I leave my id property uncommented it seems to crash. I implement the protocol in the VC. I did assign the delegate to the cell in

Is there a way to catch or handle EXC_BAD_ACCESS?

天涯浪子 提交于 2019-11-28 10:46:38
As far as I understand, EXC_BAD_ACCESS happens when you try to access bad memory (feel free to correct me if I'm wrong)? Is there a way to kind of catch it like in a try-catch in Java to prevent total app failure? Nope; EXC_BAD_ACCESS means things have gone wildly off the rails. Your program is trying to access a memory address that is invalid. I.e. memory has been corrupted and there is no predictable recovery. It may be a memory management issue. If you can reproduce the issue, turn on NSZombies and see what happens. Or post the backtrace here. Note that try-catch style exceptions are non

NSJSONSerialization results in EXC_BAD_ACCESS

荒凉一梦 提交于 2019-11-28 09:22:15
Currently I am writing an app (Target iOS 6, ARC enabled) that uses JSON for data transmission and Core Data for persistent storage. The JSON data is generated out of a MySQL database by a PHP script via json_encode. My Problem is that with data from certain tables the following code fails: - (NSDictionary *)executeFetch:(NSString *)query { NSURL *requesturl = [NSURL URLWithString:[query stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSError *dataError = nil; self.jsonData = [NSData dataWithContentsOfURL:requesturl options:kNilOptions error:&dataError]; NSError *error = nil;

swift setter causing exc_bad_access

流过昼夜 提交于 2019-11-28 01:56:31
I have a simple class below import Foundation public class UsefulClass: NSObject{ var test:NSNumber{ get{return self.test} set{ println(newValue) self.test = newValue } } override init() { super.init() self.test = 5; } } and I'm initializing it here import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() var testClass = UsefulClass() } } But it results in xcode printing out 200 5s and then crashing due to EXC_BAD_ACCESS code = 2. Why does this happen? @vadian has provided a solution in his answer, which should fix your problem. Let me just

Iphone Core Data crashing on Save

天大地大妈咪最大 提交于 2019-11-27 21:22:28
I'm currently writing an Iphone application using Core Data and I get a EXC_BAD_ACCESS error during the [managedObjectContext save:&&error] code line. This crash only happens after I modify certain fields. More specifically my entity has two string fields (out of about 10 fields), that get their values from a the return of a modal view controller (like a text editor). The crash also only happens after these fields are edited, the first time I put a value in it works fine. The reason I have string with format constructors with just strings is because I was trying to copy construct... not sure

EXC_BAD_ACCESS when copying or retaining Block

爱⌒轻易说出口 提交于 2019-11-27 20:39:39
As far as I understand a Block acts like an object, in that you can send copy or release messages to it, e.g: [myBlock copy]; However whenever I do this, or release a block, I get EXC_BAD_ACCESS. If I use the block functions, everything works as expected, e.g.: Block_copy(myBlock); I thought both ways of releasing and copying blocks were identical? It's not that much of a problem, but it is a little annoying that if I have a property (copy) which is a Block, I have to write the setter method myself. For example: With Properties: //Header @property (nonatomic, copy) void (^cancelledBlock)(void)

EXC_BAD_ACCESS message sent to deallocated instance, but I'm using ARC?

六眼飞鱼酱① 提交于 2019-11-27 19:11:13
I've got an app that gets information from a SOAP web service and I want to display the results in a UITableView . I had a previous version of this app and I'm creating a new version to basically clean things up and get rid of a bunch of legacy code that's deprecated and no longer used. In the previous version, this worked well. In the new version, not so much. Basically, the current scenario is returning 3 strings that I'm trying to use as the basis for the data in my UITableView . I'm struggling with this issue because it's so stinkin' hard to track down EXC_BAD_ACCESS errors!