RN在0.45版本以后,有了一些第三方库的依赖,而且未来版本即将放弃RCTBatchedBridge,所以为了更新版本,就需要对RN和podfile进行更新
更新前,用pod引入RN代码如下:
react_native_path = './node_modules/react-native'
pod'yoga', :path => react_native_path + '/ReactCommon/yoga'
pod 'React', :path => react_native_path, :subspecs => [ 'RCTBatchedBridge', 'Core', 'ART', 'RCTNetwork', 'RCTText', 'RCTAdSupport', 'RCTGeolocation', 'RCTWebSocket', 'RCTImage', 'RCTLinkingIOS', 'DevSupport' ]
我升级到0.49版本以后,pod引入修改如下:
react_native_path = './node_modules/react-native'
pod'yoga', :path => react_native_path + '/ReactCommon/yoga'
# Third party deps
pod 'DoubleConversion', :podspec => react_native_path + '/third-party-podspecs/DoubleConversion.podspec'
pod 'GLog', :podspec => react_native_path + '/third-party-podspecs/GLog.podspec'
pod 'Folly', :podspec => react_native_path + '/third-party-podspecs/Folly.podspec'
pod 'React', :path => react_native_path, :subspecs => [ 'CxxBridge', 'Core', 'ART', 'RCTNetwork', 'RCTText', 'RCTAdSupport', 'RCTGeolocation', 'RCTWebSocket', 'RCTImage', 'RCTSettings', 'RCTActionSheet', 'RCTCameraRoll', 'RCTVibration', 'RCTPushNotification', 'RCTAnimation', 'RCTLinkingIOS', 'DevSupport' ]
因为CxxBridge对Folly有依赖,所以使用CxxBridge必须要引入Folly
执行podupdate 或 pod install进行更新就好了
注意:DoubleConversion、GLog、Folly这几个库在国外,最好开VPN去拉