我遇到了带有符号化结果的崩溃:
iOS9.3.1(13E238)
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000001500c018
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x18181db90 objc_msgSend + 16
1 Foundation 0x182a8e454 -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 324
2 QuartzCore 0x184c8711c CA::Layer::set_delegate(objc_object*) + 72
3 UIKit 0x1872f2f40 -[UIView _createLayerWithFrame:] + 580
4 UIKit 0x1872f2a00 UIViewCommonInitWithFrame + 688
5 UIKit 0x1872f26f0 -[UIView initWithFrame:] + 140
6 UIKit 0x1872f9fb0 -[UILabel initWithFrame:] + 48
7 UIKit 0x187394f04 -[UINavigationItemView initWithNavigationItem:] + 200
8 UIKit 0x18761de4c -[UINavigationItem _defaultTitleView] + 128
9 UIKit 0x18761cfbc -[UINavigationItem _addDefaultTitleViewToNavigationBarIfNecessary] + 88
10 UIKit 0x18739e610 -[UINavigationItem setTitle:] + 260
11 UIKit 0x187392c90 -[UIViewController setTitle:] + 144
12 XXXXXXXXXXXXX 0x100107634 -[ZZFileViewController viewDidLoad] (ZZFileViewController.m:133)
13 UIKit 0x1872f0b40 -[UIViewController loadViewIfRequired] + 996
14 UIKit 0x187308fd0 -[UIViewController __viewWillAppear:] + 132
15 UIKit 0x1874a3d10 -[UINavigationController _startCustomTransition:] + 1052
16 UIKit 0x1873afd28 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
17 UIKit 0x1873afa04 -[UINavigationController __viewWillLayoutSubviews] + 60
18 UIKit 0x1873af96c -[UILayoutContainerView layoutSubviews] + 208
19 UIKit 0x1872ec0e4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 656
20 QuartzCore 0x184c92a28 -[CALayer layoutSublayers] + 148
21 QuartzCore 0x184c8d634 CA::Layer::layout_if_needed(CA::Transaction*) + 292
22 QuartzCore 0x184c8d4f4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
23 QuartzCore 0x184c8cb24 CA::Context::commit_transaction(CA::Transaction*) + 252
24 QuartzCore 0x184c8c86c CA::Transaction::commit() + 512
25 UIKit 0x1872eeef4 _UIApplicationHandleEventQueue + 4980
26 CoreFoundation 0x18215d124 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
27 CoreFoundation 0x18215cbb8 __CFRunLoopDoSources0 + 540
28 CoreFoundation 0x18215a8b8 __CFRunLoopRun + 724
29 CoreFoundation 0x182084d10 CFRunLoopRunSpecific + 384
30 GraphicsServices 0x18396c088 GSEventRunModal + 180
31 UIKit 0x187359f70 UIApplicationMain + 204
32 XXXXXXXXXXXXX 0x100125c6c main (main.m:14)
33 libdispatch.dylib 0x181c228b8 (Missing)
它显示[UIViewController setTitle]
处的崩溃,标题是从模型中提取的:
- (nonnull NSString *)title
{
NSString *lastPath = [self.directoryPath lastPathComponent];
if (0 == [lastPath length]) {
lastPath = @"/";
}
return lastPath;
}
根据我的经验,EXC_BAD_ACCESS
表示向已发布的对象发送消息。但是这里它发生在viewDidLoad
中,是否可以释放UIViewController?此外,我不认为title
方法有内存泄漏。所以我很困惑。
有任何建议吗?