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

查看:154
本文介绍了如何为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.

推荐答案

首先,您需要使用以下方式创建捆绑包:

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-> Xcode中的Archive,然后根据所需的版本执行步骤

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天全站免登陆