1

Three crash issues reported by Fabric Crashlytics.I checked the Stacktrace,these issues are similar.when initiate UIView(subclass of UIView,UIWebView etc.) my app crash. It is hard to reproduce,because only a few users affected one day. I'll appreciate it very much if you could help me.

Issue 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

Issue 1 code:

- (instancetype) initWithFrame:(CGRect)frame
    {
        self = [super initWithFrame:frame];
        if (self) {
            [self setup];
        }
        return self;
    }

Issue 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

Issue 2 code:

_grayBGView = [[UIView alloc] initWithFrame:self.bounds];
_grayBGView.backgroundColor = RGBACOLOR(0, 0, 0, 120);
_grayBGView.alpha = 0.0;
_grayBGView.hidden = YES;
[self addSubview:_grayBGView];

Issue 3 stack trace:

#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

Issue 3 code:

- (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;
}
myronZhou
  • 21
  • 4
  • not crashing in dev mode? – Rajesh May 17 '16 at 09:04
  • No,not crashing in dev mode(maybe just because it is small probability crash issue) – myronZhou May 17 '16 at 09:20
  • Get the exact use case from user/ or try simulating the use case while running the application run it in release mode – Rajesh May 17 '16 at 09:37
  • Looks like you try to use some deallocated objects. Check the methods that are called from the `init` methods, maybe some code analyzis will reveal you the culprit. – Cristik May 26 '16 at 07:01
  • Check the available RAM section in Fabric for those crashes, it might be that the device run out of memory. – Cristik May 26 '16 at 17:07

0 Answers0