exc-bad-access

Using blocks causes EXC_BAD_ACCESS

元气小坏坏 提交于 2019-12-21 22:38:15
问题 I'd like to use blocks, but it causes me a EXC_BAD_ACCESS after a few calls. My code: - (void) sendBasket { if (currentSendToBasketBlock != nil) { // there's already a webservice going... set the new one as waiting waitingSendToBasketBlock = ^ { WebServicesModel *webServicesModel = [[[WebServicesModel alloc] init] autorelease]; webServicesModel.delegate = self; [webServicesModel sendBasketToServer:currentBasket]; [self showBasketBackground]; }; [waitingSendToBasketBlock copy]; } else {

iOS Swift: unsafeMutableAddressor crash on iOS 8

我与影子孤独终老i 提交于 2019-12-21 20:52:34
问题 With the stack trace, unsafeMutableAddressor crash seems to be when it access AppConstant.kShowOverlay from controller's viewDidLoad() I have defined AppConstant.swift like below: struct AppConstant { // MARK: Properties static let kShowOverlay = false } Following is the stack trace from crashlytics: Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000048 0 libswiftCore.dylib 0x51bfc5c _TTWuRq_Ss9Indexable_GVSs5Sliceq__Ss14CollectionTypeSsFS1_10suffixFromuRq_S1_

XCode 4 Not Breaking On Correct Line on EXC_BAD_ACCESS

旧城冷巷雨未停 提交于 2019-12-21 09:30:13
问题 I recently had my xcode upgraded to version 4, and I have an EXC_BAD_ACCESS exception in my code, but despite setting NSZombieEnabled in the environment it's still showing the break point on the thread1, int retVal = UIApplicationMain(argc, argv, nil, nil); line. I'm sure I had this configured in XCode 3 to stop on the line of my code that was causing the exception. Now it doesn't do that and displays no error messages in the GDB window either. Does anyone know what I might be missing? Thanks

UIAlertView shown from background thread and with no delegate creates EXC_BAD_ACCESS

旧时模样 提交于 2019-12-21 09:08:31
问题 Here is my code: #ifdef DEBUG UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"ERROR" message:@"JSON Parsing Error" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; [alertView release]; #endif This code is executed in a background thread (responsible for parsing), and the error only happens every other time. Any idea on what is the problem here? 回答1: Dont mess with the UI from the background thread. Create a method and call that method on the main

UIAlertView shown from background thread and with no delegate creates EXC_BAD_ACCESS

淺唱寂寞╮ 提交于 2019-12-21 09:07:55
问题 Here is my code: #ifdef DEBUG UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"ERROR" message:@"JSON Parsing Error" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; [alertView release]; #endif This code is executed in a background thread (responsible for parsing), and the error only happens every other time. Any idea on what is the problem here? 回答1: Dont mess with the UI from the background thread. Create a method and call that method on the main

Cannot track down [NSData getBytes:length:] crash

笑着哭i 提交于 2019-12-21 04:30:10
问题 I got a strange EXC_BAD_ACCESS crash inside Foundation's -[NSData(NSData) getBytes:length:] method. It happens quite often, but I cannot get any meaningful information out of stack trace. There are no calls to getBytes:length: inside my code, except for open-source libraries (one in SDWebImage and one in SocketRocket ), but it doesn't seem like they're causing the crash. The only hint is that crash happens inside com.apple.CFNetwork.addPersistCacheToStorageDaemon thread, but I have no idea

Avoiding EXC_BAD_ACCESS when using the delegate pattern

血红的双手。 提交于 2019-12-20 18:08:46
问题 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

Avoiding EXC_BAD_ACCESS when using the delegate pattern

ε祈祈猫儿з 提交于 2019-12-20 18:08:13
问题 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

iOS CoreLocation (null) crash

会有一股神秘感。 提交于 2019-12-20 10:09:20
问题 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

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

天涯浪子 提交于 2019-12-20 06:10:04
问题 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