Ios React本机RCTCustomScrollView在升级到Xcode8后损坏
显然,在升级到Xcode 8时,对于react native而言。我已经按照指南修复了我遇到的错误,但当我的应用程序尝试加载Ios React本机RCTCustomScrollView在升级到Xcode8后损坏,ios,objective-c,xcode,facebook,react-native,Ios,Objective C,Xcode,Facebook,React Native,显然,在升级到Xcode 8时,对于react native而言。我已经按照指南修复了我遇到的错误,但当我的应用程序尝试加载组件时,仍然会出现以下错误 [RCTCustomScrollView refreshControl]:无法识别的选择器发送到实例0x16099e00 我的RCTScrollView.m中的代码似乎是每个人都认为导致问题的原因,如下所示: - (void)setRefreshControl:(RCTRefreshControl *)refreshControl { if
组件时,仍然会出现以下错误
[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的设备上尝试时,它在尝试加载
时崩溃
重要提示
-我运行的是react native 0.28,目前无法升级,因此我必须手动进行修复。我找到的唯一解决方案是,转到RCTScrollView.m,将
[\u scrollView refreshControl]
替换为[\u scrollView respondsToSelector:@selector(refreshControl)]
-(NSArray*)子视图
{
if(_contentView&&[_scrollviewrespondstoselector:@selector(刷新控制)]){
返回@[\u contentView,[\u scrollView refreshControl];
}
返回@u contentView?@[\u contentView]:@[];
}
我知道这是一篇比较老的帖子,但是对于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;
这对我很有帮助。非常感谢
@implementation RCTCustomScrollView
{
__weak UIView *_dockedHeaderView;
// Added the following line
RCTRefreshControl *_refreshControl;
}
// Also added this
@synthesize refreshControl = _refreshControl;