如何离线捆绑ios in react native

时间:2017-02-07 13:57:58

标签: react-native react-native-ios

任何人都可以请你解释如何从'react native'代码生成离线的ios应用程序包。

我已经尝试过“How to generate .ipa file for react-native?”,但这不起作用。

3 个答案:

答案 0 :(得分:8)

react-native run-ios --configuration=release

将使用捆绑包在Simulator或Device上运行您的应用程序。

或者只是从Xcode构建它(发布版本总是包含bundle) 或者运行调试版本,但在此之前,你应该:

react-native bundle --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios

此外,由于我们需要运行此新的react-native版本index.ios.js,

react-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --platform ios

答案 1 :(得分:0)

方法1

第一步:

react-native bundle --entry-file index.ios.js --bundle-output ./ios/main.jsbundle --platform ios

第二步:

react-native run-ios --configuration=release 

这个工人对我来说。

方法2 使用xcode并更改调试以发布 enter image description here

答案 2 :(得分:0)

我假设您希望在ios设备上运行该应用程序而不将其部署到应用程序商店中。 如果是这种情况,那么:

首先,我将确保已安装ios-deploy

您可以通过运行npm install -g ios-deploy

然后将要安装应用程序的iPhone连接到Mac。

然后运行

react-native run-ios --device "XYZ’s iPhone" --configuration=release

这将创建一个离线js捆绑应用程序,并将其安装到iphone。

PS:如果错误说出

Signing for "<app name>" requires a development team. 
Select a development team in the project editor.

然后在Xcode中的ios/中打开项目,然后 选择目标->常规选项卡 在“签名”下,选择签名团队,然后选择“自动管理签名”。

然后保存并重新运行命令。