调整oc代码,将调试模式注释,开启离线模式
// 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
开启服务打包
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的所有权转移到另外一个账号
提包
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
设置更新策略
codePush.sync(options: Object, syncStatusChangeCallback: function(syncStatus: Number), downloadProgressCallback: function(progress: DownloadProgress)): Promise<Number>;
sync方法,提供了如下属性以允许你定制sync方法的默认行为
- deploymentKey (String): 部署key,指定你要查询更新的部署秘钥,默认情况下该值来自于Info.plist(Ios)和MianActivity.java(Android)文件,你可以通过设置该属性来动态查询不同部署key下的更新。
- installMode (codePush.InstallMode): 安装模式,用在向CodePush推送更新时没有设置强制更新(mandatory为true)的情况下,默认codePush.InstallMode.ON_NEXT_RESTART即下一次启动的时候安装。
- mandatoryInstallMode (codePush.InstallMode):强制更新,默认codePush.InstallMode.IMMEDIATE。
- minimumBackgroundDuration (Number):该属性用于指定app处于后台多少秒才进行重启已完成更新。默认为0。该属性只在installMode为InstallMode.ON_NEXT_RESUME情况下有效。
- updateDialog (UpdateDialogOptions) :可选的,更新的对话框,默认是null,包含以下属性
- appendReleaseDescription (Boolean) - 是否显示更新description,默认false
- descriptionPrefix (String) - 更新说明的前缀。 默认是” Description: “
- mandatoryContinueButtonLabel (String) - 强制更新的按钮文字. 默认 to “Continue”.
- mandatoryUpdateMessage (String) - 强制更新时,更新通知. Defaults to “An update is available that must be installed.”.
- optionalIgnoreButtonLabel (String) - 非强制更新时,取消按钮文字. Defaults to “Ignore”.
- optionalInstallButtonLabel (String) - 非强制更新时,确认文字. Defaults to “Install”.
- optionalUpdateMessage (String) - 非强制更新时,更新通知. Defaults to “An update is available. Would you like to install it?”.
- title (String) - 要显示的更新通知的标题. Defaults to “Update available”.
网友评论