Why do i get exc bad access in cases when object is not nil?

Posted by DixieFlatline on Stack Overflow See other posts from Stack Overflow or by DixieFlatline
Published on 2012-09-07T09:08:24Z Indexed on 2012/09/07 9:38 UTC
Read the original article Hit count: 330

I have an app that receives remote notifications. My view controller that is shown after push has a tableview. App crashes very randomly (1 in 20 tries) at line setting frame:

if (!myTableView) {
        NSLog(@"self.myTableView is nil");
    }
    myTableView.frame=CGRectMake(0, 70, 320, 376);

This only happens when i open the app, then open some other apps and then receive the push notification. I guess it has something to do with memory. I use ARC (ios 5). The strange thing is that nslog is not displayed, so tableview is not nil.

Crash log:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x522d580c
Crashed Thread:  0

 Thread 0 name:  Dispatch queue: com.apple.main-thread
 Thread 0 Crashed:
 0   libobjc.A.dylib                0x352b1f7e objc_msgSend + 22
 1   Foundation                     0x37dc174c NSKVOPendingNotificationCreate + 216
 2   Foundation                     0x37dc1652 NSKeyValuePushPendingNotificationPerThread + 62
 3   Foundation                     0x37db3744 NSKeyValueWillChange + 408
 4   Foundation                     0x37d8a848 -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 176
 5   Foundation                     0x37e0ca14 _NSSetPointValueAndNotify + 76
 6   UIKit                          0x312af25a -[UIScrollView(Static) _adjustContentOffsetIfNecessary] + 1890
 7   UIKit                          0x312cca54 -[UIScrollView setFrame:] + 548
 8   UIKit                          0x312cc802 -[UITableView setFrame:] + 182
 9   POViO                          0x000913cc -[FeedVC viewWillAppear:] (FeedVC.m:303)

Dealloc is not called because it is not logged:

- (void)dealloc {

NSLog(@"dealloc");

}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c