Fabric Crashlytics报告了三个崩溃问题。我检查了Stacktrace,这些问题是类似的。当启动UIView(UIView的子类,UIWebView等)时,我的应用程序崩溃了。它很难重现,因为只有少数用户有一天会受到影响。 如果你能帮助我,我会非常感激。
问题1 stacktrace:
#0 Crashed: com.apple.main-thread EXC_BAD_ACCESS 0x00000000008a8877
CA::Layer::Layer(CALayer*, CA::Layer::State const&, CA::Layer::State const*, CA::Transaction*, unsigned int) + 85
7 UIKit -[UIView initWithFrame:] + 116
8 MyAPP __PIMediaPlayerBuiltInScreen.m line 39 [__PIMediaPlayerBuiltInScreen initWithFrame:]
9 MyAPP __PIMediaPlayerBuiltInUI.m line 82 -[__PIMediaPlayerBuiltInUI setupVideoScreen]
10 MyAPP __PIMediaPlayerBuiltInUI.m line 57 -[__PIMediaPlayerBuiltInUI initWithFrame:]
11 MyAPP __PIMediaPlayerBuiltInUI.m line 45 +[__PIMediaPlayerBuiltInUI defaultPlayerUI]
12 MyAPP PIMediaPlayer.m line 1397 -[PIMediaPlayer setupPlayerUI]
13 MyAPP PIMediaPlayer.m line 358 -[PIMediaPlayer setupPlayer]
14 MyAPP PIMediaPlayer.m line 332 -[PIMediaPlayer initWithFrame:]
15 MyAPP PIMediaPlayerCachablePlayer.m line 58 -[PIMediaPlayerCachablePlayer initWithFrame:]
16 MyAPP
PIContentHeadlineItemVideoView.m line 34 -[PIContentHeadlineItemVideoView initWithFrame:]
17 MyAPP PIContentHeadlineView.m line 157 -[PIContentHeadlineView carousel:viewForItemAtIndex:reusingView:]
18 MyAPP iCarousel.m line 1198-[iCarousel loadViewAtIndex:withContainerView:]
19 MyAPP iCarousel.m line 1325-[iCarousel loadUnloadViews]
20 MyAPP iCarousel.m line 1899-[iCarousel didScroll]
21 MyAPP iCarousel.m line 1762-[iCarousel step]
22 Foundation __NSFireTimer + 64
问题1代码:
- (instancetype) initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
问题2 stacktrace:
#0 Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000109b69b4000
QuartzCore x_mem_alloc_bucket + 60
5 UIKit -[UIView initWithFrame:] + 140
6 MyAPP AlbumContentItemView.m line 390-[AlbumContentItemView initPhotoTextViewWithDefaultLines:textDirection:textBackgroundEnabled:]
7 MyAPP AlbumContentItemView.m line 507-[AlbumContentItemView initView]
8 MyAPP AlbumContentItemView.m line 77-[AlbumContentItemView initWithFrame:data:index:offsetY:]
9 MyAPP CardViewController.m line 1378-[CardViewController nextView]
10 MyAPP VideoScrollView.m line 216-[VideoScrollView scrolledBackward]
11 MyAPP VideoScrollView.m line 244-[VideoScrollView scrollViewDraggingFinished]
12 UIKit -[UIScrollView(UIScrollViewInternal) _scrollViewDidEndDeceleratingForDelegate] +160
第2期代码:
_grayBGView = [[UIView alloc] initWithFrame:self.bounds];
_grayBGView.backgroundColor = RGBACOLOR(0, 0, 0, 120);
_grayBGView.alpha = 0.0;
_grayBGView.hidden = YES;
[self addSubview:_grayBGView];
问题3堆栈跟踪:
#0 Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000010a87fc4000
QuartzCore x_mem_alloc_bucket + 60
10 UIKit -[UIWebView initWithFrame:] + 80
11 MyAPP PIContentCardSnsEmbedView.m line 105 -[PIContentCardSnsEmbedView webView]
12 MyAPP PIContentCardSnsEmbedView.m line 56-[PIContentCardSnsEmbedView awakeFromNib]
13 UIKit -[UINib instantiateWithOwner:options:] + 2188
14 UIKit -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 224
15 MyAPP NSObject+PIUtil.m line 14+[NSObject(PIUtil) loadObjectFromMainBundleOfClass:fromNib:]
16 MyAPP PIContentCardSnsEmbedView.m line 36+[PIContentCardSnsEmbedView viewFromDefaultNib]
17 MyAPP AlbumContentItemView.m line 779-[AlbumContentItemView initView]
18 MyAPP AlbumContentItemView.m line 77-[AlbumContentItemView initWithFrame:data:index:offsetY:]
19 MyAPP CardViewController.m line 1378-[CardViewController nextView]
20 MyAPP VideoScrollView.m line 216-[VideoScrollView scrolledBackward]
21 MyAPP VideoScrollView.m line 244-[VideoScrollView scrollViewDraggingFinished]
22 UIKit -[UIScrollView(UIScrollViewInternal) _scrollViewDidEndDeceleratingForDelegate] + 160
第3期代码:
- (UIWebView *)webView
{
if (!_webView) {
_webView = [[UIWebView alloc] initWithFrame:CGRectMake(EMBED_CARD_MARGIN, 0, self.frame.size.width-(EMBED_CARD_MARGIN*2), self.alignCenter ? 1 : self.frame.size.height)];
_webView.backgroundColor = [UIColor clearColor];
_webView.scrollView.backgroundColor = [UIColor clearColor];
_webView.opaque = NO;
_webView.scrollView.bounces = NO;
_webView.allowsInlineMediaPlayback = YES;
_webView.delegate = self;
_webView.dataDetectorTypes = UIDataDetectorTypeNone;
_webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[_webView.scrollView addObserver:self forKeyPath:OBSERVER_KEY_CONTENTSIZE options:NSKeyValueObservingOptionInitial context:nil];
}
return _webView;
}