Tag: bad access

在使用扩展CLPlacemark的自定义类填充NSMutableArray之后删除不良访问

我有一个PlaceAnnotation类,我填充到一个NSMutableArray。 在viewDidLoad中,我发起ihatethis _ihatethis = [[NSMutableArray alloc]init]; 我使用MKLocalSearchCompletionHandler进行search。 并处理这样的地图项: for (MKMapItem *mapItem in [response mapItems]){ PlaceAnnotation *place = [[PlaceAnnotation alloc] init]; [place assignTitle:[[mapItem placemark] name]; [_ihatethis addObject:place]; } [_ihatethis removeObjectAtIndex:2]; /*BAD ACCESS HERE*/ [_tableView reloadData]; 这是我的PlaceAnnotation.h文件 @interface PlaceAnnotation : CLPlacemark <MKAnnotation> @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, readonly, copy) NSString *title; @property (nonatomic) NSDictionary* dict; […]

iOS – 设置UITextView的文本会引发EXC_BAD_ACCESS

我有一个UITextView ,我已经在下面的代码中编程创build: NSLog(@"creating the first blurb"); blurb = [[UITextView alloc]initWithFrame:CGRectMake(0, 0, 320, 50)]; [blurb setText:total]; blurb.backgroundColor = [UIColor redColor]; blurb被定义为@interface的UITextView 。 这是我遇到问题的地方: total是一个NSString ,它被定义为从指定域的.txt文件中获取文本。 它被改变为: NSString *url = @"https://sites.google.com/site/paloaltoapps/tbnappsource-password-blackr3d/Updates.txt"; NSURL *urlRequest = [NSURL URLWithString:url]; total = [NSString stringWithContentsOfURL:urlRequest encoding:NSUTF8StringEncoding error:nil]; 但是,当我运行代码时,我得到了顶部代码块的setText:行EXC_BAD_ACCESS抛出的EXC_BAD_ACCESS实例。 我已经尝试使用NSLog语句打印出来,这似乎工作得很好。 任何人都可以看到我做错了什么? 谢谢。

exc_bad_access on

我得到奇怪的行为[NSDate timeIntervalSinceReferenceDate] 。 我有以下function: -(void) insertRow{ NSTimeInterval timeNow = [NSDate timeIntervalSinceReferenceDate]; if (timeNow – secondsSinceTableViewScroll <0.5){ [self insertRow]; return; } NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:[self.itemsToFollow count] – 1]; [self.tableView insertSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic]; } 这是从ASIHTTPRequest requestFinishedcallback。如果我在代码中放置一个断点,它工作正常。 如果我只是尝试运行代码,我得到一个exc_bad_access就行了: NSTimeInterval timeNow = [NSDate timeIntervalSinceReferenceDate]; secondsSinceTableViewScroll是在头中声明的伊娃,并设置像这样: secondsSinceTableViewScroll = [NSDate timeIntervalSinceReferenceDate]; 任何想法,为什么我没有断点时获得exc_bad_access? 谢谢 只有我能find的东西 我正在检查这样的时间: -(void) insertRow{ end = [NSDate timeIntervalSinceReferenceDate]; […]

ios通知“死”的对象

我有一些UIViews进入视图,然后走出看法和未使用。 不过,我相信其中一些人在收到通知后,即使在他们离开后也会造成问题。 在UIView“父”容器上: if(self._content != nil && [self._content respondsToSelector:@selector(presentMe:)]) { [self._content presentMe:NO]; } 在UIView“孩子”: [[NSNotificationCenter defaultCenter] <– EXC_BAD_ACCESS (code=1, address=0x70000008 postNotificationName:PRESENTING object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:prepareToEnter], PRESENTING, nil]]; 一切工作都是第一次,但如果我第二次启动相同的视图,我会得到一个EXC_BAD_ACCESS。 这不是说有什么缺失吗? 仅供参考,这是所有在ARC – Xcode 4.3.2

显示从后台线程和没有委托UIAlertView创buildEXC_BAD_ACCESS

这是我的代码: #ifdef DEBUG UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"ERROR" message:@"JSON Parsing Error" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; [alertView release]; #endif 这段代码在后台线程中执行(负责parsing),并且错误只发生在其他时间。 任何想法在这里是什么问题?

上的访问错误

我在我的UICollectionView中遇到了一个奇怪的崩溃。 崩溃的UICollectionViewembedded在另一个UICollectionView的UICollectionView单元格中。 我不能重现这个问题,它似乎有时如果内部UICollectionView得到新的初始化,因为外面的CollectionView正在重新加载它的单元格。 com.apple.main-thread崩溃 0 libobjc.A.dylib objc_msgSend + 9 1 UIKit – [UICollectionViewData _setLayoutAttributes:atGlobalItemIndex:] + 60 2 UIKit __45- [UICollectionViewData validateLayoutInRect:] _ block_invoke_0 + 668 3 UIKit – [UICollectionViewData validateLayoutInRect:] + 1408 4 UIKit – [UICollectionViewData layoutAttributesForElementsInRect:] + 82 5 UIKit – [UICollectionView setCollectionViewLayout:animated:] + 1644 6 MyApp BSCTopnewsCollectionView.m第52行 – [BSCTopnewsCollectionView setupBSCTopnewsCollectionView] 7 MyApp BSCTopnewsCollectionView.m第27行 […]

无法追查崩溃

在Foundation的-[NSData(NSData) getBytes:length:]方法中,我EXC_BAD_ACCESS了一个奇怪的EXC_BAD_ACCESS崩溃。 它经常发生,但是我无法从堆栈跟踪中得到任何有意义的信息。 没有调用getBytes:length:在我的代码中,除了开放源代码库(一个在SDWebImage ,一个在SocketRocket ),但看起来不像是导致崩溃。 唯一的提示是崩溃发生在com.apple.CFNetwork.addPersistCacheToStorageDaemon线程内,但是我不知道它是什么。 有人可以帮忙吗? Crashlytics的Stacktrace: Thread : Crashed: com.apple.CFNetwork.addPersistCacheToStorageDaemon 0 libsystem_platform.dylib 0x3044a208 _platform_memmove$VARIANT$CortexA9 + 160 1 Foundation 0x22df9167 -[NSData(NSData) getBytes:length:] + 118 2 Foundation 0x22df9167 -[NSData(NSData) getBytes:length:] + 118 3 Foundation 0x22e21a1b -[NSData(NSData) replacementObjectForCoder:] + 134 4 Foundation 0x22dc2aff -[NSXPCEncoder _replaceObject:] + 90 5 Foundation 0x22e240dd -[NSXPCEncoder _encodeArrayOfObjects:forKey:] + 192 6 […]

actionForLayer中的崩溃:forKey:

当改变一些UILabel的框架时,我有一个神秘的EXC_BAD_ACCESS。 碰撞是随机的,通常我必须重复几分钟的条件。 启用NSZombies,以及其他内存debugging标志(NSDebugEnabled,MallocStackLogging),没有帮助,崩溃仍然保持不透明:只是一个BAD_ACCESS没有消息在控制台。 目标似乎是正确的和活着的,所以它看起来不像一个解除分配的内存问题。 为了获得更多信息,我分类了UILabel并重写了崩溃函数: @implementation TestUILabel – (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event { return [super actionForLayer:layer forKey:event]; } @end 它在超级的方法崩溃,但在检查一切似乎是正确的(打印retainCount“自我”和“层”分别给出3和2): (gdb)po自我 <TestUILabel:0x6ac2800; baseClass = UILabel; 帧=(173 174; 0 0); 文字= '54平方米'; opaque = NO; autoresize = LM + TM; autoresizesSubviews = NO; userInteractionEnabled = NO; animation= {position = <CABasicAnimation:0xe07ba60>; }; 层= <CALayer:0xbf1b950 >> (gdb)po事件 界限 […]

Swift中的parser.parse()会导致EXC_BAD_ACCESS

我正在关注这个教程,作为我在Swift中工作的RSS提要应用程序的一个开始。 自从本教程以来,我知道在Swift中有些事情已经发生了变化,但是他们都没有解释为什么我会遇到这个问题。 相关代码(据我所知)如下在我的TableViewController: override func viewDidLoad() { super.viewDidLoad() let url:NSURL = NSURL(string: "my.url.string") parser = NSXMLParser(contentsOfURL: url) parser.delegate = self parser.parse() // <- Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) } 实际的parsing器委托方法似乎没有问题,因为我在这些方法上放置了断点,在崩溃之前甚至没有被调用。 我的假设是,这是一个Swift错误,但我想确保我没有错过任何东西,然后我去抱怨苹果。

当从不同的线程使用NSDateFormatter崩溃

我们不断得到NSDateFormatter一个随机,奇怪的崩溃。 相关的堆栈跟踪是: Program received signal: “EXC_BAD_ACCESS”. #0 0x00000005 in ?? () #1 0x0213e3c3 in udat_parse () #2 0x01d4e1ca in CFDateFormatterGetAbsoluteTimeFromString () #3 0x01d4e225 in CFDateFormatterCreateDateFromString () #4 0x003e2608 in getObjectValue () #5 0x003e2921 in -[NSDateFormatter getObjectValue:forString:errorDescription:] () #6 0x003e21cd in -[NSDateFormatter dateFromString:] () date格式化程序仍然在内存中(即不释放或损坏)。 我唯一能想到的是在崩溃时的string不符合格式,但我怀疑这会使格式化程序完全崩溃。 (事先检查格式是不重要的)。 有什么想法吗?