iOS tableView在cellForRowAtIndexPath中读取数组为空的问题

在viewDidload中实现异步读取数据后,在数组(NSMutableArray)中添加此对象数据,刷新tableView
结果在numberOfRowsInSection可以获取到该数组中的对象,但在cellForRowAtIndexPath中获取到得数组却为空,求大神帮忙看看

- (NSMutableArray *)noticeArray
{
    if (!_noticeArray) {
        _noticeArray = [NSMutableArray array];
    }
    return _noticeArray;
}

下面是同过异步请求得到的数据,并添加进数组,刷新tableView

  NSMutableArray *noticesArray = [NSMutableArray array];
        for (NoticeWithNews *notice in array) {
            NoticeResult *model = [[NoticeResult alloc] init];
            model.noticeWithNews = notice;
            [noticesArray addObject:model];
        }       
         self.noticeArray = noticesArray;        
        [self.tableView reloadData];

至此都还没出现问题,打印的 self.noticeArray也有添加的对象
下面是numberOfRowsInSection,刷新tableView之后打印的self.noticeArray.count有值。

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    NSLog(@"%ld",self.noticeArray.count);
    return self.noticeArray.count;
}

但是到cellForRowAtIndexPath中打印的self.noticeArray,就一直为空

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


    static NSString *identifier = @"identifier";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];

    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier];
    }
    NSLog(@"%@",self.noticeArray[indexPath.row]);


    return cell;
}

2017-02-02 11:15:31.164 校园新闻[2555:68321] 4
2017-02-02 11:15:31.164 校园新闻[2555:68321] (null)
2017-02-02 11:15:31.165 校园新闻[2555:68321] (null)
2017-02-02 11:15:31.166 校园新闻[2555:68321] (null)
2017-02-02 11:15:31.167 校园新闻[2555:68321] (null)


求大神帮忙解答下,为什么在cellForRowAtIndexPath拿到的数组self.noticeArray会突然变为NULL

这里的数组建议你全部使用_array这样调用,不要懒加载。数组你懒加载有什么用。

问题解决了,是因为数组引用成了弱指针的缘故,改成strong就好了,一直没注意到用了weak