加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ios – React Native RCTCustomScrollView升级到Xcode8后损坏

发布时间:2020-12-14 17:25:43 所属栏目:百科 来源:网络整理
导读:显然,this is a well known issue在升级到Xcode 8时反应原生.我已按照 this指南修复我遇到的错误,但当我的应用程序尝试加载 ScrollView /时仍然出现以下错误零件. [RCTCustomScrollView refreshControl]:无法识别的选择器发送到实例0x16099e00 每个人似乎认
显然,this is a well known issue在升级到Xcode 8时反应原生.我已按照 this指南修复我遇到的错误,但当我的应用程序尝试加载< ScrollView />时仍然出现以下错误零件.

[RCTCustomScrollView refreshControl]:无法识别的选择器发送到实例0x16099e00

每个人似乎认为我的RCTScrollView.m中的代码导致问题如下所示:

- (void)setRefreshControl:(RCTRefreshControl *)refreshControl
{
  if (refreshControl) {
    [refreshControl removeFromSuperview];
  }
  refreshControl = refreshControl;
  [self addSubview:refreshControl];
}

- (void)removeReactSubview:(UIView *)subview
{
  if ([subview isKindOfClass:[RCTRefreshControl class]]) {
  _scrollView.refreshControl = nil;
  } else {
    RCTAssert(_contentView == subview,@"Attempted to remove non-existent subview");
    _contentView = nil;
    [subview removeFromSuperview];
  }
}

当我在运行iOS 10.1.1的设备上运行时,一切似乎都运行良好,但是当我尝试运行9.3的设备时,它在尝试加载< ScrollView />时崩溃.

重要的提示
– 我正在运行反应原生0.28,我现在无法升级,因此我必须手动修复.

解决方法

我知道这是一个较旧的帖子,但对于Xcode 8,iOS 9.3(iPad 2 / iPad Mini),React Native 0.24.1,我在RCTScrollView.m中进行了此更改作为修复.

@implementation RCTCustomScrollView
{
  __weak UIView *_dockedHeaderView;

 // Added the following line
 RCTRefreshControl *_refreshControl;
}
// Also added this
@synthesize refreshControl = _refreshControl;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读