7

谁能解释一下如何从“react native”代码生成离线 iOS 应用程序包?

我已经尝试过如何为 react-native 生成​​ .ipa 文件?但它不工作。

4

3 回答 3

31
react-native run-ios --configuration=release

将使用捆绑包在模拟器或设备上运行您的应用程序。

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

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
于 2017-02-07T14:18:25.803 回答
5

我假设您希望在 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/并选择目标 -> 常规选项卡在签名下选择签名团队并选择自动管理签名。

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

于 2019-03-17T23:11:31.753 回答
1

方法一

第一步:

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

第二步:

react-native run-ios --configuration=release 

这个工人对我来说。

方法 2 使用 xcode 并将 debug 更改为 release,如下所示: 在此处输入图像描述

于 2019-02-27T03:13:54.103 回答