調(diào)整oc代碼挠蛉,將調(diào)試模式注釋堂湖,開啟離線模式
// NSString * strUrl = @"http://10.1.5.99:8081/index.ios.bundle?platform=ios&dev=true";
// NSURL *jsCodeLocation = [NSURL URLWithString:strUrl];
NSString *path = [[NSBundle mainBundle] pathForResource:@"index.ios.jsbundle" ofType:@""];
NSURL *jsCodeLocation = [NSURL URLWithString:path];
react-native 打離線包
Options:
--entry-file Path to the root JS file, either absolute or relative to JS root [required]
--platform Either "ios" or "android"
--transformer Specify a custom transformer to be used (absolute path) [default: "/Users/babytree- mbp13/projects/xcodeProjects/AwesomeProject/node_modules/react-native/packager/transformer.js"]
--dev If false, warnings are disabled and the bundle is minified [default: true]
--prepack If true, the output bundle will use the Prepack format. [default: false]
--bridge-config File name of a a JSON export of __fbBatchedBridgeConfig. Used by Prepack. Ex. ./bridgeconfig.json
--bundle-output File name where to store the resulting bundle, ex. /tmp/groups.bundle [required]
--bundle-encoding Encoding the bundle should be written in ([https://nodejs.org/api/buffer.html#buffer_buffer).](https://nodejs.org/api/buffer.html#buffer_buffer).) [default: "utf8"]
--sourcemap-output File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map
--assets-dest Directory name where to store assets referenced in the bundle
--verbose Enables logging [default: false]
react-native bundle --entry-file index.ios.js --bundle-output ./BigApps/BigappsRN/index.ios.jsbundle --platform ios --assets-dest ./BigApps/BigappsRN --dev false
node node_modules/react-native/local-cli/cli.js start
react-native bundle --entry-file ./jsProtected/Project/index.ios.js --bundle-output ./jsProtected/Bundles/weiwei.bundle --platform ios --dev false
開啟服務(wù)打包
curl http://localhost:8081/index.ios.bundle -o ./BigApps/BigappsRN/index.ios.jsbundle
curl http://localhost:8081/index.ios.bundle -o ./bundle/index.ios.jsbundle
code push
命令
code-push login
登陸
code-push logout
注銷
code-push access-key ls
列出登陸的token
code-push access-key rm <accessKye>
刪除某個 access-key
code-push app add
在賬號里面添加一個新的app
code-push app remove
或者 rm 在賬號里移除一個app
code-push app rename
重命名一個存在app
code-push app list
或則 ls 列出賬號下面的所有app
code-push app transfer
把app的所有權(quán)轉(zhuǎn)移到另外一個賬號
提包
code-push release ios-bigapps ./BigApps/BigappsRN/index.ios.jsbundle 1.3 --deploymentName Production --description "1.測試" --mandatory true
code-push release bigapps ./bundle/index.ios.jsbundle 0.0.1 --description "select" --mandatory true
設(shè)置更新策略
codePush.sync(options: Object, syncStatusChangeCallback: function(syncStatus: Number), downloadProgressCallback: function(progress: DownloadProgress)): Promise<Number>;
sync方法着降,提供了如下屬性以允許你定制sync方法的默認(rèn)行為
- deploymentKey (String): 部署key侦讨,指定你要查詢更新的部署秘鑰窘面,默認(rèn)情況下該值來自于Info.plist(Ios)和MianActivity.java(Android)文件,你可以通過設(shè)置該屬性來動態(tài)查詢不同部署key下的更新件相。
- installMode (codePush.InstallMode): 安裝模式再扭,用在向CodePush推送更新時沒有設(shè)置強制更新(mandatory為true)的情況下,默認(rèn)codePush.InstallMode.ON_NEXT_RESTART即下一次啟動的時候安裝夜矗。
- mandatoryInstallMode (codePush.InstallMode):強制更新,默認(rèn)codePush.InstallMode.IMMEDIATE泛范。
- minimumBackgroundDuration (Number):該屬性用于指定app處于后臺多少秒才進行重啟已完成更新。默認(rèn)為0紊撕。該屬性只在installMode為InstallMode.ON_NEXT_RESUME情況下有效罢荡。
- updateDialog (UpdateDialogOptions) :可選的,更新的對話框对扶,默認(rèn)是null,包含以下屬性
- appendReleaseDescription (Boolean) - 是否顯示更新description区赵,默認(rèn)false
- descriptionPrefix (String) - 更新說明的前綴。 默認(rèn)是” Description: “
- mandatoryContinueButtonLabel (String) - 強制更新的按鈕文字. 默認(rèn) to “Continue”.
- mandatoryUpdateMessage (String) - 強制更新時浪南,更新通知. Defaults to “An update is available that must be installed.”.
- optionalIgnoreButtonLabel (String) - 非強制更新時笼才,取消按鈕文字. Defaults to “Ignore”.
- optionalInstallButtonLabel (String) - 非強制更新時,確認(rèn)文字. Defaults to “Install”.
- optionalUpdateMessage (String) - 非強制更新時络凿,更新通知. Defaults to “An update is available. Would you like to install it?”.
- title (String) - 要顯示的更新通知的標(biāo)題. Defaults to “Update available”.