简体   繁体   English

如何使用 Expo 在真实的 iOS 设备上运行应用程序?

[英]How do I run an app on a real iOS device using Expo?

I am using Expo to run my application.我正在使用 Expo 来运行我的应用程序。 I am able to see two options in Expo XDE:我能够在 Expo XDE 中看到两个选项:

  1. open on iOS simulator在 iOS 模拟器上打开
  2. open on Android打开 Android XDE

I want to run my app by directly connecting to my device.我想通过直接连接到我的设备来运行我的应用程序。 Is it possible with Expo? Expo 可以吗?

Yes, it is possible, and quite easy to get it running. 是的,这是可能的,并且很容易让它运行。

Step 1: Open Expo XDE, and click on the gray cog to change host mode to LAN. 步骤1:打开Expo XDE,然后单击灰色齿轮将主机模式更改为LAN。 Make sure you enabled Development Mode. 确保启用了开发模式。 You'll see an URL right in front of you. 你会在你面前看到一个URL。 Wait until packager to start running. 等到打包机开始运行。

电脑

Step 2: Open Expo App in your mobile device, and click on the second tab ' Explore ' and enter the URL that starts with exp://192.168... This is a local connection to your computer. 步骤2:在移动设备中打开Expo App,然后单击第二个选项卡“ Explore ”并输入以exp://192.168...开头的URL exp://192.168...这是与您的计算机的本地连接。 You will see your app running in a minute. 您将在一分钟内看到您的应用运行。

Make sure your phone and computer are on the same WiFi! 确保您的手机和电脑在同一个WiFi上!

For further information, you may refer to official documents here . 有关详细信息,请参阅此处的官方文档。

在此输入图像描述

As the Expo Client App is updated due to new Apple's approval requirements, please follow the steps below to launch the App in a real iOS device: 由于新的Apple批准要求更新了Expo Client应用程序,请按照以下步骤在真实iOS设备中启动应用程序:

  1. Connect both your computer and your iOS device with same Wi-Fi 使用相同的Wi-Fi连接计算机和iOS设备
  2. In Expo XDE, select Host > LAN (please refer to eden's answer) 在Expo XDE中,选择主机> LAN(请参阅伊甸园的答案)
  3. Open MobileSafari in your iOS device. 在iOS设备中打开MobileSafari。 Type the URL shown in Expo XDE (should be something like exp://192.168.123.123:19000). 输入Expo XDE中显示的URL(应该类似于exp://192.168.123.123:19000)。 Alternatively, you can click "Share" button in Expo XDE to show a QR Code. 或者,您可以单击Expo XDE中的“共享”按钮以显示QR码。 Use Camera App in iOS (iOS 11+) or any QR code reader (iOS 9 & 10) to scan the QR Code. 在iOS(iOS 11+)或任何QR码阅读器(iOS 9和10)中使用Camera App扫描QR码。
  4. MobileSafari, or your QR code reader / Camera App, will ask if you want to launch the App in Expo Client App, select "Yes" MobileSafari或您的QR码阅读器/相机应用程序将询问您是否要在Expo Client App中启动应用程序,选择“是”
  5. Your project will be loaded accordingly. 您的项目将相应加载。

Hope it helps. 希望能帮助到你。

步骤3的屏幕截图

If you are looking to run a native build without using Expo Go on a physical iOS device (not a simulator), you can use the following code:如果您希望在物理 iOS 设备(而非模拟器)上不使用Expo Go运行本机构建,则可以使用以下代码:

npx expo run:ios --device

This is useful in cases when you need to test notifications, native code, etc.这在您需要测试通知、本机代码等的情况下很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在真实设备上使用我的 Expo 应用程序? - How can I use my Expo App on a real device? 如何在真实设备上捆绑和部署React-Native iOS应用 - How to bundle and deploy React-Native iOS app on real device 使用物理 IOS 设备从 Expo 应用程序连接到本地 Express API - Connecting to local Express API from Expo app using physical IOS device 如何通过快捷方式 ios 应用程序运行网站定义的 javascript function? - How do I run a javascript function defined by the website via the Shortcuts ios app? 如何使用 JavaScript 判断应用程序是否安装在 ios 设备上? - How to tell if an app is installed on an ios device using JavaScript? 如何使用 Expo 在 React-Native 应用程序上按顺序运行异步函数 - How to run async functions sequentially on a React-Native app, using Expo 如何在登录页面上添加 Android 和 iOS 设备图像 - How do I add Android & iOS device images on the landing page 如何使用Appium在真实设备上更改时间? - How to change the time on a real device using Appium? 我尝试在 iOS 和 Android 设备上运行我的 React 应用程序时遇到此错误 - I got this error trying to run my React app on a iOS and Android device 无法在 Android 模拟器中运行反应本机应用程序 - 使用 EXPO cli - Not able to run react native app in Android Emulator - using EXPO cli
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM