19

I am using Expo to run my application. I am able to see two options in Expo XDE:

  1. open on iOS simulator
  2. open on Android XDE

I want to run my app by directly connecting to my device. Is it possible with Expo?

ide
  • 19,942
  • 5
  • 64
  • 106
Ankush Rishi
  • 2,861
  • 8
  • 27
  • 59

3 Answers3

21

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. Make sure you enabled Development Mode. You'll see an URL right in front of you. Wait until packager to start running.

computer

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. You will see your app running in a minute.

Make sure your phone and computer are on the same WiFi!

For further information, you may refer to official documents here.

enter image description here

eden
  • 5,876
  • 2
  • 28
  • 43
  • 5
    'Explore' tab doesn't exist anymore, would you mind updating your answer accordingly ? – Milad Apr 22 '18 at 02:25
  • Thanks Raptor, I wasn’t able to access my computer and update the answer – eden Aug 02 '18 at 10:07
  • You have to open the link over Safari on your mobile device :) it will launch expo. – tryp Dec 06 '18 at 20:41
  • Is there no way to get a `.ipa` or use the `tar.gz` generated with `expo build:ios -t simulator` and install it on the device ? Please confirm if we can just use `exp://` or if we can install the app and get the icon like does the app on the iOS simulator when it start. – Dimitri Kopriwa Dec 26 '19 at 23:36
14

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:

  1. Connect both your computer and your iOS device with same Wi-Fi
  2. In Expo XDE, select Host > LAN (please refer to eden's answer)
  3. Open MobileSafari in your iOS device. Type the URL shown in Expo XDE (should be something like exp://192.168.123.123:19000). Alternatively, you can click "Share" button in Expo XDE to show a QR Code. Use Camera App in iOS (iOS 11+) or any QR code reader (iOS 9 & 10) to scan the QR Code.
  4. MobileSafari, or your QR code reader / Camera App, will ask if you want to launch the App in Expo Client App, select "Yes"
  5. Your project will be loaded accordingly.

Hope it helps.

Screenshot for Step 3

Raptor
  • 53,206
  • 45
  • 230
  • 366
  • 3
    Is there no way to get a `.ipa` or use the `tar.gz` generated with `expo build:ios -t simulator` and install it on the device ? Please confirm if we can just use `exp://` or if we can install the app and get the icon like does the app on the iOS simulator when it start. – Dimitri Kopriwa Dec 26 '19 at 23:36
  • Be aware that many things do not quite work the same way when running in the Expo app on iOS and Android. This approach is okay for rapid prototyping, but it is not a replacement for testing your app natively on your device. – Chris Jaynes Sep 22 '20 at 23:39
4

If you are looking to run a native build without using Expo Go on a physical iOS device (not a simulator), you can plug in your device to your computer by cable and use the following code:

npx expo run:ios --device

This is useful in cases when you need to test notifications, native code, etc.

Brian Li
  • 2,260
  • 1
  • 15
  • 18