如何为 React Native 构建 .ipa? [英] How to build .ipa for React Native?

查看:27
本文介绍了如何为 React Native 构建 .ipa?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在没有 iOS 开发经验的情况下来到 React Native 开发.我想构建发布..ipa 文件 - 理想情况下来自命令行,但官方文档 在设备上运行 非常简短.

I come to React Native development without previous experience in iOS development. I want to build release. .ipa file - ideally from the command line but the official documentation Running On Device is very brief.

我能够通过 XCode 在我的 iPhone 上手动部署应用程序,但仍然找不到任何发布 IPA".文件.我已经使用 #ifdef DEBUG 指令更新了我的代码,使其更通用.

I was able to deploy applications on my iPhone manually via XCode but still, I can't find any "release IPA" file. I have updated my code with #ifdef DEBUG directives to make it more generic.

有没有办法只通过命令行在发布模式下构建应用程序?如果不是,什么是官方"?生成 RN 应用程序的方法?

Is there a way to build an application in release mode only via the command-line? If no, what is "the official" way to generate an RN application?

我目前使用的是 RN 0.20.

I am currently using RN 0.20.

推荐答案

首先,你需要这样创建一个bundle:

First, you need to create a bundle this way :

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

然后,你必须在 AppDelegate.m 中注释这一行:

Then, you have to comment this line in AppDelegate.m :

jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];

并取消注释:

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

然后你必须去 Product -> Archive in Xcode 并根据你想要的版本按照步骤操作

Then you have to go for Product -> Archive in Xcode and follow the steps based on your desired release

这篇关于如何为 React Native 构建 .ipa?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆