How to Run React Native App on an iOS Simulator

Academind by Maximilian Schwarzmüller
A free video tutorial from Academind by Maximilian Schwarzmüller
Online Education
4.6 instructor rating • 27 courses • 1,512,820 students

Learn more from the full course

React Native - The Practical Guide [2021 Edition]

Use React Native and your React knowledge to build native iOS and Android Apps - incl. Push Notifications, Hooks, Redux

32:29:01 of on-demand video • Updated May 2021

  • Build native mobile apps with JavaScript and React
  • Dive deeper into React Native
  • Develop cross-platform (iOS and Android) mobile apps without knowing Swift, ObjectiveC or Java/ Android
English So we installed Android Studio and launched the app here on an Android emulator, now let's do the same on iOS and this as I mentioned before only works on MacOS, you can't do this on Windows unfortunately. The first step there is that you install Xcode and you do that from inside your App Store, so the App Store on your Mac. There you can simply search for Xcode and then install Xcode, I already got it installed but simply install it from there. These are the Apple Developer tools, you can only install them on a Mac and you should do so there. With that installed, make sure you install the Xcode command line tools by simply launching Xcode and there, without necessarily opening a project, you don't have to do that, go into Xcode preferences in the top left corner and then make sure you got command line tools installed here by selecting the most recent entry you have here under command line tools. That is already all, you can now launch a simulator by going to Xcode and then open developer tool simulator here and this will now launch up an iOS simulator, here it is booting up and for me it picked an iPhone X here. You can change that simulator by clicking on it and then going to hardware here, device and then selecting iOS and you can pick different phones and if you choose a different one here, it will launch a new emulator with that different configuration and here, I'll just go with this iPhone XS simulator, I closed all simulators and then restarted it and then it automatically picks the last one you chose here and now let's wait for this to boot up before we can run our React Native expo app there. Here it is running and now again, go back to your npm start process which should be up and running and in there, you can hit I to launch this project on an iOS simulator. Alternatively, you can always go to the expo dev tools in that browser tab and click run on iOS simulator there, that would work as well. Here, you also see some log where it tells you that it's connecting and so on. So now here, we're asked whether we want to open this in expo and the answer is yes, just as on Android, it automatically installed the expo app so you don't need to do that manually, it does it for you and then it launches this app and launches your project in that app. So let's again wait for that to finish, click got it here and here's the app and just as on the real device, we can click change text to change the text. So this is the app now running on simulators, this is the setup I'll use for the course so that I can show this app on different devices here on the screen. You can test it on simulators as well, you can test it on real native devices, before you ever publish an app, you should definitely also test it on real devices though, otherwise you won't know how your app behaves there. So using simulators only is not an option but for development, it's of course great.