如何通过 Xcode 将 React Native iOS 应用程序构建到设备? [英] How do I build React Native iOS app to device through Xcode?

查看:57
本文介绍了如何通过 Xcode 将 React Native iOS 应用程序构建到设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将 AwesomeProject 应用程序构建到设备上.构建成功并显示启动画面,但随后我看到一个红色的无法连接到开发服务器"屏幕.它说确保节点服务器正在运行 - 从 React root 运行‘npm start’."

I tried building the AwesomeProject app to device. The build succeeds and the splash screen shows, but then I see a red "Could not connect to development server" screen. It says that "Ensure node server is running - run 'npm start' from React root."

看起来节点服务器已经在运行,因为当我执行 npm start 时,我收到一条 EADDRINUSE 消息,说该端口已在使用中.

It looks like the node server is already running because when I do npm start I get an EADDRINUSE message, saying that the port is already in use.

推荐答案

从设备访问开发服务器您可以使用开发服务器在设备上快速迭代.为此,您的笔记本电脑和手机必须位于同一 wifi 网络中.

Accessing development server from device You can iterate quickly on device using development server. To do that, your laptop and your phone have to be on the same wifi network.

  1. 打开 iOS/AppDelegate.m
  2. 将 URL 中的 IP 从 localhost 更改为您笔记本电脑的 IP
  3. 在 Xcode 中选择您的手机作为构建目标,然后按构建并运行"

ps:http://facebook.github.io/react-native/docs/runningondevice.html#content

这篇关于如何通过 Xcode 将 React Native iOS 应用程序构建到设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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