iOS Development

ios – How you can run expo challenge on an iPhone that I join by way of USB-C?

Spread the love


That is actually fairly easy – simply plug the cellphone by way of a Lightning to USB cable into the Mac to get a community connection.

The community connection will likely be between the iPhone and the Mac solely. It’s not by default an web connection for the cellphone, however that’s not wanted for Expo growth.

On the Mac in System Preferences > Community, you will see the cellphone listed as “iPhone USB”. Click on on “iPhone USB” and you will see the cellphone’s IP-address.

You probably have different technique of connection enabled on the cellphone, you would possibly must take away the checkmark from “Disable except wanted” and click on Apply – however aside from that, you mechanically have a community connection to the Mac now.

In case you’re working a macOS model the place you don’t see it within the graphical interface, you may as a substitute run this Terminal command:

ifconfig

Evaluate the output earlier than and after plugging within the iPhone, and you will see {that a} new community interface named “enXX” (the place X’s are numbers) seems after plugging within the iPhone. The IP tackle listed is the IP tackle of your pc on this non-public community.

Now to make it possible for the Expo server makes use of this non-public community as a substitute of your WiFi for speaking with the cellphone, you set its preliminary interface like this within the Terminal:

export EXPO_DEVTOOLS_LISTEN_ADDRESS=169.254.246.125
export REACT_NATIVE_PACKAGER_HOSTNAME=169.254.246.125
expo begin

Exchange 169.254.246.125 with the precise IP tackle you see listed to your pc.

In case you additionally need to share the web connection of your Mac with the cellphone, you are able to do that from System Preferences > Sharing > Web Sharing. This allows NAT, so you’ll expertise that the interface in your Mac, in addition to the interface in your iPhone, now have completely different IP addresses, and you will must replace the instructions above accordingly.

Leave a Reply

Your email address will not be published. Required fields are marked *