Tag: bad access

为什么设置整数时会发生EXC_BAD_ACCESS和SIGABRT?

我写了代码。 我想用nsuserdefault保存整数。 但是这个代码发生了EXC_BAD_ACCESS和SIGABRT。 – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { … [self desave:[newys integerValue] :[newms integerValue]]; … } … – (void)desave:(NSInteger*)year :(NSInteger*)month//←EXC BAD ACCESS happened on this row. { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setInteger:year forKey:@"year"];//←SIGABRT happened on this row. [defaults synchronize]; }

iOS:lldb EXC_BAD_ACCESS自定义单元格

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"LibraryListingCell"; InSeasonCell *cell = (InSeasonCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"InSeasonCellView" owner:self options:nil]; cell = [_cell autorelease]; _cell = nil; } if(_dataController!=NULL){ Product *productAtIndex = [_dataController objectInListAtIndex:indexPath.row]; // Configure the cell… if (productAtIndex.name != nil && productAtIndex.week != nil && […]

仅当testing时MKMapView导致EXC_BAD_ACCESS

当只在设备上testing时,我得到了EXC_BAD_ACCESS。 当我刚刚运行应用程序时,这不会发生。 我担心我的用户会遇到崩溃,即使我不是在testing时。 任何人有任何想法为什么? 这似乎与我的注释没有关系,因为我注释了注释的添加,它仍然崩溃。 此外,它加载在地图的第一个视图,但是当我回到我的集合视图,然后回到这个视图是当它崩溃。 我的坐标似乎也是有效的,因为它通过了有效性检查。 //////THIS IS ALL THE MAP VIEW STUFF…… self.mapView.delegate = self; self.mapView = [[MKMapView alloc] initWithFrame:CGRectMake(17, 650, 733, 300)]; self.mapView.scrollEnabled = NO; self.mapView.zoomEnabled = NO; self.mapView.showsUserLocation = YES; CLLocationCoordinate2D location; NSMutableArray *newAnnotations = [NSMutableArray array]; MKPointAnnotation *newAnnotation; location.latitude = [[_selectedCategoryItem objectForKey:@"latitude"]doubleValue]; location.longitude = [[_selectedCategoryItem objectForKey:@"longitude"]doubleValue]; NSLog(@"Latitude ==> %f", [[_selectedCategoryItem […]

UIImagePickerController EXC_BAD_ACCESS错误

我build立了我的应用程序来运行,如下所示: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; UIImagePickerController* picker = [[UIImagePickerController alloc] init]; self.viewController = picker; self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; return YES; } 在图像select器出现后,我select“Camera Roll”。 之后,我按下后退button(标题为“照片”)。 应用程序崩溃,提供EXC_BAD_ACCESS错误。 当我启用僵尸对象时,收到“EXC_ARM_BREAKPOINT(子代码= 0xdefe)”错误,并显示以下日志。 或者: [UIView willRemoveSubview:]: message sent to deallocated instance 0x2088ea20 或者如果我继续进行图像select: -[PLImageScrollView willRemoveSubview:]: message sent to deallocated instance […]

UIAlertview exc_bad_access

我添加了一个函数来closuresUIAlertView几秒钟后。整个代码是这样的: – (void)netWorkAlert { UIAlertView *netWork = [[UIAlertView alloc] initWithTitle:@"error" message:@"network has problems" delegate:self cancelButtonTitle:nil otherButtonTitles: nil]; [netWork show]; [self performSelector:@selector(dismissAlert:) withObject:netWork afterDelay:2]; } – (void)dismissAlert:(UIAlertView *)alert { if(alert) { [alert dismissWithClickedButtonIndex:0 animated:YES]; [alert release]; } } networking不可用时调用netWorkAlert 。 现在我遇到的问题是当第二次调用netWorkAlert时,应用程序被破坏,Xcode显示错误 int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([ZJAppDelegate class])); //Thread […]

EXC_BAD_ACCESS在touchesBegan之后

我已经开始了一个学习iOS编程的非常简单的项目,但是在touchesBegan之后我得到了EXC_BAD_ACCESS 。 您可以在这里从DropBox下载项目。 我基本上有一个UIView子类,应该在用户触摸的地方绘制圆圈。 很简单,但我不能让它工作。 任何帮助,高度赞赏。 谢谢! 编辑原来这个问题是在touchesBegan这行代码: ts = [NSMutableSet setWithSet: [event touchesForView:self]]; 我改成: ts = [[NSMutableSet setWithSet: [event touchesForView:self]] retain];

Swift:self.init(coder:aDecoder)正在崩溃与EXC_BAD_ACCESS的应用程序

使用NSCoder和NSKeyArchiver时,错误是崩溃的应用程序。 我在NSCoder上做了一个最近的post,但自那以后,我改变了我的代码,并得到一个新的错误,并决定一个新的职位是最好的。 该应用程序是一个博客阅读器,从使用PHP的MYSQL数据库中读取,以使用JSON在Swift中使用自定义对象填充表视图。 我一直在试图保存mainArray,以便当用户移动单元跨过部分(每个部分都有一个数组)时,它可以保存用户离开它的地方。 Blog.swift:处理博客自定义对象 import UIKit class Blog: NSObject, NSCoding { var blogName: String! var blogStatus1: String! var blogStatus2: String! var blogURL: String! var blogID: String! var blogType: String! var blogDate: String! var blogPop: String! static func createBlog(from jsonObject: AnyObject) -> Blog? { guard let bID: String = jsonObject.object(forKey: "id") as? String, let bName: […]

我应该怎么做才能调用audioPlayerDidFinishPlaying:

我写这个源程序。 但是我不能调用audioPlayerDidFinishPlaying:方法。 播放声音后,几秒钟后由“exc_bad_access”错误崩溃。 .h文件 #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface SecondViewController : UIViewController< AVAudioPlayerDelegate>{ AVAudioPlayer *aPlayer; } @end .m文件 -(void)playSound{ NSString *soundName = @"red"; NSError *error = nil; NSURL *soundUrl = [[NSBundle mainBundle] URLForResource:soundName withExtension:@"mp3"]; aPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:&error]; if (error != nil) { NSLog(@"audio_player initialized error :(%@)",[error localizedDescription]); [aPlayer release]; error=nil; return; } […]

IOS6上的NSDateComponents无法正常工作?

我有一个简单的程序与IOS4和5一起工作。现在与IOS 6我收到以下错误信息: 2012-10-05 11:08:16.386 app[1698:19d03] 2012-10-05 09:08:11 +0000 2012-10-05 11:08:18.072 app[1698:19d03] 2012-10-05 09:08:11 +0000 2012-10-05 11:08:19.273 app[1698:19d03] 2012-10-05 09:08:11 +0000 2012-10-05 11:08:19.274 app[1698:19d03] 2012-10-05 09:08:11 +0000 2012-10-05 11:08:19.275 app[1698:19d03] 0 2012-10-05 11:08:25.055 app[1698:19d03] 2011-10-05 09:08:11 +0000 2012-10-05 11:08:25.823 app[1698:19d03] ( "<UILongPressGestureRecognizer: 0xa167f60; state = Possible; view = <UITableViewCellContentView 0xa168000>; target= <(action=_longPressGestureRecognized:, target=<UIPickerTableViewWrapperCell 0xa168090>)>>") 2012-10-05 11:08:25.824 […]

如何从相机胶卷获取照片?

我试图使用ALAssetLibrary来获取专辑和照片。 这是我的代码: void(^ assetEnumerator)(struct ALAsset *,NSUInteger,BOOL *)= ^(ALAsset * result,NSUInteger index,BOOL * stop){ if(result!= NULL){ NSLog(@“See Asset:%@”,result); } }; void(^ assetGroupEnumerator)(struct ALAssetsGroup *,BOOL *)= ^(ALAssetsGroup * group,BOOL * stop){ if(group!= nil){ [group enumerateAssetsUsingBlock:assetEnumerator]; } }; ALAssetsLibrary * library = [[ALAssetsLibrary alloc] init]; [库enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:assetGroupEnumerator failureBlock:^(NSError * error){ 的NSLog(@ “失败”); }]; 我得到exc_bad_access:[组enumarateAssetsUsingBlock:assetEnumerator]和组不是零。 奇怪的是,这个代码工作,如果我创build一个新的项目,但在我的旧项目,它不工作。 SDK版本是iOS 4.3 在iPhoneSimulator […]