Мое приложение вылетает при выборе вкладки.Вот код, который вылетает.
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if ([viewController isKindOfClass:[UINavigationController class]]) {
[(UINavigationController*)viewController popToRootViewControllerAnimated:NO];
}
}
Это код, который является проблемой.Видимо, когда я popToRoot контроллер, сообщение отправляется на освобожденный объект.
DealElementDisplayController *dealElementDisplayController = [[DealElementDisplayController alloc] initWithStores:storeIds :YES];
dealElementDisplayController.title = [NSString stringWithFormat:@"%@ Products", store.companyName];
[self.navigationController pushViewController:dealElementDisplayController animated:YES];
Вот исключение.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xe0000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3648af78 objc_msgSend + 16
1 UIKit 0x320e809c -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 540
2 UIKit 0x320e717a -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1070
3 UIKit 0x320e6904 -[UITableView layoutSubviews] + 200
4 UIKit 0x3208b0d8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 176
5 CoreFoundation 0x34fc81f4 -[NSObject performSelector:withObject:] + 36
6 QuartzCore 0x36b53a9e -[CALayer layoutSublayers] + 210
7 QuartzCore 0x36b536b6 CA::Layer::layout_if_needed(CA::Transaction*) + 210
8 QuartzCore 0x36b5783c CA::Context::commit_transaction(CA::Transaction*) + 220
9 QuartzCore 0x36b57578 CA::Transaction::commit() + 308
10 QuartzCore 0x36b7f90a CA::Transaction::flush() + 38
11 QuartzCore 0x36b7f8dc +[CATransaction flush] + 28
12 UIKit 0x32096152 _afterCACommitHandler + 46
13 CoreFoundation 0x3503db14 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
14 CoreFoundation 0x3503bd50 __CFRunLoopDoObservers + 252
15 CoreFoundation 0x3503c0aa __CFRunLoopRun + 754
16 CoreFoundation 0x34fbf49e CFRunLoopRunSpecific + 294
17 CoreFoundation 0x34fbf366 CFRunLoopRunInMode + 98
18 GraphicsServices 0x362bb432 GSEventRunModal + 130
19 UIKit 0x320b5e76 UIApplicationMain +
Вот трассировка стека из профиля зомби.Я использую ARC.
0 CoreFoundation ___forwarding___
1 CoreFoundation _CF_forwarding_prep_0
2 UIKit -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:]
3 UIKit -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:]
4 UIKit -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:]
5 UIKit -[UITableView layoutSubviews]
6 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
7 CoreFoundation -[NSObject performSelector:withObject:]
8 QuartzCore -[CALayer layoutSublayers]
9 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*)
10 QuartzCore CA::Context::commit_transaction(CA::Transaction*)
11 QuartzCore CA::Transaction::commit()
12 QuartzCore +[CATransaction flush]
13 UIKit _afterCACommitHandler
14 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
15 CoreFoundation __CFRunLoopDoObservers
16 CoreFoundation __CFRunLoopRun
17 CoreFoundation CFRunLoopRunSpecific
18 CoreFoundation CFRunLoopRunInMode
19 GraphicsServices GSEventRunModal
20 GraphicsServices GSEventRun
21 UIKit UIApplicationMain