我们在同一个名为“MyViewController”的视图控制器中,尽管它崩溃很难复现,但我们从Crashlytics获得了这个崩溃...
我们从Crashlytics收到以下崩溃日志:
请帮我解决这个问题...非常感谢!
提前致谢。
- (void)dismiss {
MyViewController* __weak weakSelf = self;---->//Crashing here
[UIView animateWithDuration:0.25 animations:^{
MyViewController* __strong strongSelf = weakSelf;
if (strongSelf) {
CGRect backFrame = strongSelf.shroud.frame;
strongSelf.shroud.backgroundImageView.frame = backFrame;
strongSelf.shroud.shadedOverlay.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
CGRect semiViewFrame = CGRectMake(0, strongSelf.view.frame.size.height, strongSelf.shroud.contentView.frame.size.width, strongSelf.shroud.contentView.frame.size.height);
strongSelf.shroud.contentView.frame = semiViewFrame;
}
}
completion:^(BOOL finished){
MyViewController* __strong strongSelf = weakSelf;
if (strongSelf) {
[strongSelf.shroud removeFromSuperview];
strongSelf.shroud = nil;
strongSelf.semiViewController = nil;
}
}];}
我们从Crashlytics收到以下崩溃日志:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x39d148f8 _objc_trap() + 18446744073709552000
1 libobjc.A.dylib 0x39d1495d _objc_inform
2 libobjc.A.dylib 0x39d233cb weak_register_no_lock + 182
3 libobjc.A.dylib 0x39d236ff objc_storeWeak + 110
4 applicationName 0x000e8071 -[MyViewController dismiss] (MyViewController:144)
5 UIKit 0x31f357f9 _UIGestureRecognizerSendActions + 196
6 UIKit 0x31de0a93 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 1138
7 UIKit 0x321880bf ___UIGestureRecognizerUpdate_block_invoke + 46
8 UIKit 0x31da794f _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 218
9 UIKit 0x31da60b3 _UIGestureRecognizerUpdate + 298
10 UIKit 0x31ddf305 -[UIWindow _sendGesturesForEvent:] + 772
11 UIKit 0x31ddec2b -[UIWindow sendEvent:] + 666
12 UIKit 0x31db3e55 -[UIApplication sendEvent:] + 196
13 UIKit 0x31db2521 _UIApplicationHandleEventQueue + 7120
14 CoreFoundation 0x2f548faf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
15 CoreFoundation 0x2f548477 __CFRunLoopDoSources0 + 206
16 CoreFoundation 0x2f546c67 __CFRunLoopRun + 630
17 CoreFoundation 0x2f4b1729 CFRunLoopRunSpecific + 524
18 CoreFoundation 0x2f4b150b CFRunLoopRunInMode + 106
19 GraphicsServices 0x344106d3 GSEventRunModal + 138
20 UIKit 0x31e12871 UIApplicationMain + 1136
请帮我解决这个问题...非常感谢!
提前致谢。
weakSelf
或使用strong。 - Ilesh P_strong weakSelf
。 - Ilesh P