RollingNotice icon indicating copy to clipboard operation
RollingNotice copied to clipboard

崩溃位置,如下图所示

Open HKH01 opened this issue 6 years ago • 22 comments

GYRollingNoticeView.m的93行,int count = (int)[self.dataSource numberOfRowsForRollingNoticeView:self];崩溃

HKH01 avatar Mar 14 '18 08:03 HKH01

原因呢,你是什么情况下崩溃的,设置dataSource 了吗

maltsugar avatar Mar 14 '18 09:03 maltsugar

设置了

- (GYRollingNoticeView *)noticeView {
    if (!_noticeView) {
        _noticeView = [[GYRollingNoticeView alloc] init];
        _noticeView.backgroundColor = [UIColor whiteColor];
        _noticeView.dataSource = self;
        _noticeView.delegate = self;
        [_noticeView registerClass:[MJHomeNoticeCell class] forCellReuseIdentifier:NSStringFromClass([MJHomeNoticeCell class])];
    }
    return _noticeView;
}
- (NSInteger)numberOfRowsForRollingNoticeView:(GYRollingNoticeView *)rollingView {
    
    return self.noticeArray.count;
}

- (__kindof GYNoticeViewCell *)rollingNoticeView:(GYRollingNoticeView *)rollingView cellAtIndex:(NSUInteger)index {
    
    MJHomeNoticeCell *noticeCell = [rollingView dequeueReusableCellWithIdentifier:NSStringFromClass([MJHomeNoticeCell class])];
    if (!noticeCell) {
        noticeCell = [[MJHomeNoticeCell alloc] initWithReuseIdentifier:NSStringFromClass([MJHomeNoticeCell class])];
    }
    if (self.noticeArray.count) {
        noticeCell.titleStr = self.noticeArray[index];
    }
    
    return noticeCell;
}

HKH01 avatar Mar 14 '18 09:03 HKH01

额 MJHomeNoticeCell 这个继承了GYNoticeViewCell了吗

maltsugar avatar Mar 16 '18 07:03 maltsugar

或者你方便建个空工程,把你的类发出来吗

maltsugar avatar Mar 16 '18 07:03 maltsugar

继承了。因为我也没有复现这个崩溃,我是根据苹果提供的崩溃信息定位到的

HKH01 avatar Mar 16 '18 07:03 HKH01

default 这是崩溃信息截图,希望有帮助。

HKH01 avatar Mar 16 '18 07:03 HKH01

这看不出来啊 复现也复现不了。只能先观察了😢

maltsugar avatar Mar 16 '18 09:03 maltsugar

会不会是后台久了,被系统干掉了

maltsugar avatar Mar 16 '18 09:03 maltsugar

楼主,我好像是也遇到了这个问题。

Baiyongyu avatar Aug 01 '18 09:08 Baiyongyu

又复现了,同样的位置,
could not execute support code to read Objective-C class data in the process. This may reduce the qu

Baiyongyu avatar Aug 07 '18 01:08 Baiyongyu

好的 我查下你这个原因的资料。 你可以主动复现吗 @Baiyongyu

maltsugar avatar Aug 07 '18 01:08 maltsugar

搜到一个资料说懒加载不能用self. ,看了下代码里面没有self. 有个self 改了下,可以在这里下新版试下,还没推到pod上,感觉不像这的问题

maltsugar avatar Aug 07 '18 02:08 maltsugar

偶发性的,复现也挺难。

Baiyongyu avatar Aug 07 '18 02:08 Baiyongyu

这个功能是在app首页,导致崩溃的原因应该都是进入到其他页面,然后返回首页的时候,不止什么原因就导致偶发性崩溃了

Baiyongyu avatar Aug 07 '18 02:08 Baiyongyu

你有在首页 视图出现和视图消失的时候,操作这个控件吗

maltsugar avatar Aug 07 '18 03:08 maltsugar

操不操作,都会导致这个崩溃,一开始没有调用stop的操作,我后在视图消失的时候加上的。

Baiyongyu avatar Aug 07 '18 05:08 Baiyongyu

image

Baiyongyu avatar Aug 07 '18 08:08 Baiyongyu

我昨天用模拟器挂了一天,包括停留首页,进入第二页,返回。 都没问题

maltsugar avatar Aug 08 '18 01:08 maltsugar

如果不需要释放内存的,不用在页面消失时 停止

maltsugar avatar Aug 08 '18 01:08 maltsugar

https://www.jianshu.com/p/4989c498e21e 可以看下这个,检查下内存,是不是DataSource被释放了🙏

maltsugar avatar Aug 08 '18 01:08 maltsugar

image 改用weak

qhlonger avatar Nov 28 '18 09:11 qhlonger

有道理,感谢@qhlonger提出,我写assign写习惯了,对象用weak好些,先更新git上的,pod 暂时没更新

maltsugar avatar Nov 29 '18 07:11 maltsugar