显然,
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;