github連接熱更新,動(dòng)態(tài)補(bǔ)丁修復(fù),這個(gè)幾乎已經(jīng)成了大型APP的標(biāo)配。
原生目前也有比較成熟的解決方案:動(dòng)態(tài)補(bǔ)丁修復(fù)(iOS,Android) - 簡(jiǎn)書
如果使用了React-Native,熱更新動(dòng)態(tài)修復(fù)將變得更加簡(jiǎn)單,不用再想runtime會(huì)不會(huì)導(dǎo)致一些奇怪的問題,直接從源碼把問題修復(fù),更加可靠。目前實(shí)現(xiàn)思路的大同小異,建議有三條路可以走:
1.使用Code push,微軟團(tuán)隊(duì),技術(shù)能力有保證,但服務(wù)器在國(guó)外。不過通過網(wǎng)絡(luò)響應(yīng)測(cè)試速度還是能接受的,而且支持補(bǔ)丁更新未來下載的包的體積會(huì)很小。
2.使用國(guó)內(nèi)類似Code-push,現(xiàn)在還處于測(cè)試版的GitHub - reactnativecn/react-native-pushy: 敬請(qǐng)期待中文網(wǎng)推出的代碼熱更新服務(wù)
3.有條件的話,自己搭建熱更新平臺(tái)。ReactNative增量升級(jí)方案 - react-native - SegmentFault
開始使用Code push
GitHub - Microsoft/react-native-code-push: React Native plugin for the CodePush service.
(一)安裝到你的react-natvie程序
cd 項(xiàng)目路徑
npm install --save react-native-code-push@latest
(二)在原生程序里連接code-push
iOS?
在Podfile 添加
pod'CodePush',:path=>'./node_modules/react-native-code-push'
然后運(yùn)行 pod install
修改jsCodeLocation 指向
jsCodeLocation = [CodePushbundleURL];
Android
查看GitHub - Microsoft/react-native-code-push: React Native plugin for the CodePush service.