exc-bad-access

Avoiding EXC_BAD_ACCESS when using the delegate pattern

浪子不回头ぞ 提交于 2019-12-03 05:54:06
A have a view controller, and it creates a "downloader" object, which has a reference to the view controller (as a delegate). The downloader calls back the view controller if it successfully downloads the item. This works fine as long as you stay on the view, but if you navigate away before the download is complete I get EXC_BAD_ACCESS . I understand why this is happening, but is there any way to check if an object is still allocated? I tried to test using delegate != nil , and [delegate respondsToSelector:] , but it chokes. if (!self.delegate || ![self.delegate respondsToSelector:@selector

How to debug EXC_BAD_ACCESS in iPhone app when I can't determine the cause?

醉酒当歌 提交于 2019-12-03 04:17:59
Help, I've been hacking at this for weeks now! I have this app I am developing in the Simulator, and I have done a lot of the UI stuff, it is just getting to the interesting part with data. It started immediately upon launch, about 90% of the time I run it, it will raise EXC_BAD_ACCESS exception. I have commented out all of my release messages, and even added some retain messages to be sure it is not something that is over released. Weird thing is, sometimes something I do in the code will make it work, then it works until I make another code change. Then I comment out the new code I added,

iOS CoreLocation (null) crash

谁都会走 提交于 2019-12-02 21:13:15
I've been getting this error in my app through Crashlytics. I can't find where and how this crash occurs. Here is the log from Crashlytics: Thread : Crashed: com.apple.main-thread 0 CoreLocation 0x0000000183f62304 (null) + 60044 1 CoreLocation 0x0000000183f230f0 (null) + 1436 2 CoreLocation 0x0000000183f230f0 (null) + 1436 3 CoreLocation 0x0000000183f2261c (null) + 1980 4 CoreFoundation 0x0000000183754c9c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28 5 CoreFoundation 0x0000000183754940 __CFRunLoopDoTimer + 884 6 CoreFoundation 0x0000000183752054 __CFRunLoopRun + 1520 7

Getting info about bad memory address in LLDB

。_饼干妹妹 提交于 2019-12-02 16:23:59
I am trying to debug an EXC_BAD_ACCESS in my iPhone app. It is crashing on a method call and on the line of the method is EXC_BAD_ACCESS (code=1, address = xxx) . Before, I would have just used gdb info malloc-history <xxx> to start debugging, but I am having trouble finding a parallel command in LLDB . I saw this thread that said to use Instruments, but when I do I still get the crash but I can't figure out how to tell exactly where the app is crashing from in Instruments. I just need to figure out where this piece of memory that is crashing was pointing to. What is the best way to do this

Image is not fetching from database

二次信任 提交于 2019-12-02 14:13:30
问题 I stored some images in my server. I used JSON for fetch remote data from server. When i was storing images in local database it was working. When i use json url it's not working. Im getting EXC_BAD_ACCESS error. code: Mysof.h file: @interface Mysof : NSObject{ NSInteger sofaId; NSString *sofa; NSString *rating; UIImage *photo; } @property (nonatomic,retain)NSString *sofa; @property (nonatomic, assign) NSInteger sofaId; @property (nonatomic, retain)NSString *rating; @property (nonatomic,

Delegate assignment causes EXC_BAD_ACCESS

我的未来我决定 提交于 2019-12-02 13:11:38
I am trying to create a delegate for an NSTextField in my view controller, but the program crashes with EXC_BAD_ACCESS . Why does this happen? I read that I am calling a non-existent object, but I don´t know what does not exist. I am using ARC. This is how the delegate object is created in my view controller: #import <Cocoa/Cocoa.h> #import "Delegate.h" @interface ViewController : NSViewController <NSTextFieldDelegate>{ } @end -- #import "ViewController.h" @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSTextField* textField1 = [[NSTextField alloc] initWithFrame

Where is EXC_BAD_ACCESS documented? [closed]

空扰寡人 提交于 2019-12-02 12:51:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . One of the more commonplace debugging errors in my own development (Mac, iOS) is EXC_BAD_ACCESS. Despite its commonness, its origin and precise meaning remain mysterious. Google lists many occurrences of the error, but the only explanation I could find is informal and incomplete. I know that this exception (if

Resolving EXC_BAD_ACCESS Issue In Cocoa?

柔情痞子 提交于 2019-12-02 12:08:22
问题 Hey..i have the following method in cocoa.. -(void)startUploadWithContainerName:(NSString *)containerName { //Make an object of NSFileManager and Fetch an array of local folder contents and cloud folder contents NSFileManager *uploadManager=[[NSFileManager alloc] init]; NSString *uploadPath=[[[NSString alloc] initWithString:@"~/Cloud Briefcase"] stringByExpandingTildeInPath]; NSError *err; NSArray *uploadFolderContents=[uploadManager contentsOfDirectoryAtPath:uploadPath error:&err];

“EXC_BAD_ACCESS” when switch too fast between an tableView and a mapView

时光总嘲笑我的痴心妄想 提交于 2019-12-02 11:19:44
I have a tableView with an button to push a mapView. The push and back actions generally work fine. If I switch quickly between these two views, "EXC_BAD_ACCESS" error will appear. MapViewController.m - (void)viewDidLoad { [super viewDidLoad]; self.mapView.delegate = self; UIButton *btnL = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40.0, 40.0)]; [btnL setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal]; [btnL addTarget:self.navigationController action:@selector(popViewControllerAnimated:) forControlEvents:UIControlEventTouchDown]; self.navigationItem

EXC_BAD_ACCESS Using IBInspectable

旧时模样 提交于 2019-12-02 09:25:53
I am trying to use IBInspectable to add borders to my views. extension UIView { private func getBorder(integer: Int) -> UIRectEdge { if integer == 1 { return .top } else if integer == 2 { return .left } else if integer == 3 { return .right } else if integer == 4 { return .bottom } return .all } @IBInspectable var border: Int? { get { return self.border } set (value) { self.border = value for v in addBorder(edges: self.getBorder(integer: self.border!)) { self.addSubview(v) } } } @IBInspectable var borderColor: UIColor? { get { return self.borderColor } set (value) { self.borderColor = value /