2016-11-30 57 views
4

顯然,this is a well known issue在升級到Xcode 8時反應原生。我按照this指南修復了我遇到的錯誤,但是當我的應用嘗試加載時,我仍然收到以下錯誤<ScrollView/>組件。React Native升級到Xcode8後RCTCustomScrollView壞了

[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 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 9.1.1的設備上運行此,但是當我嘗試運行9.3的設備時,它在嘗試加載<ScrollView/>時崩潰。

重要提示 - 我運行原生的反應和0.28是在緊張的情況下,我現在不能升級,因此我必須手動進行修復。

回答

0

我發現的唯一的解決辦法是這樣的,去RCTScrollView.m和替換[_scrollView refreshControl][_scrollView respondsToSelector: @selector(refreshControl)]

- (NSArray<UIView *> *)reactSubviews 
{ 
    if (_contentView && [_scrollView respondsToSelector: @selector(refreshControl)]) { 
    return @[_contentView, [_scrollView refreshControl]]; 
    } 
    return _contentView ? @[_contentView] : @[]; 
} 
0

我知道這是一個老帖子,但對於Xcode中8,的iOS 9.3(iPad的2/iPad的迷你),React Native 0.24.1,我在RCTScrollView.m中做了這個修改。

@implementation RCTCustomScrollView 
{ 
    __weak UIView *_dockedHeaderView; 

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