9

Can you build for iOS with react-native on Windows? Or does it require xcode?

If so, any work arounds? I dont want to work on a mac... or a mac vm.

4
  • You can not build for iOS with react-native on windows. You need to have xcode. Commented Sep 9, 2019 at 23:40
  • 1
    If you use Expo, you can. How did you start your project? with Expo or directly react-native init ? Commented Sep 10, 2019 at 6:55
  • It was going to be react-native with expo Commented Sep 10, 2019 at 13:58
  • Yes, @izniburak, great point. You’re right that using Expo would also work — until if/when he reaches limitations and have to eject the app. He probably needs to map out the modules and needs first. If he has a simple app, Expo might be the cool solution he needs. If it gets complex, see my other answer. Commented Sep 13, 2019 at 3:51

3 Answers 3

2

The short answer is NO. iOS apps need to build on a Mac. However, if you have a cheap old Mac, or even a Mac cloud account, you can effectively do the equivalent while (almost) never touching the Mac. Of course, this assumes that it has been setup up once, and builds via Xcode or Xcode command line. Once that is done, you can automate it so that you're working and testing only on the PC.

For example, I once took over a React Native project where the previous developer did something similar. Because it was a generic interface, he coded on his PC, then tested via the Android emulator without ever testing for iOS. At that point you can simply push code to GitHub (manually, or with something like Fastlane or a user script). Separately, you have a script on that old Mac or online Mac-as-a-service that checks periodically and builds when the code changes. There were some times when the Mac needed special attention, but for the most part, it worked solely on one machine.

Sign up to request clarification or add additional context in comments.

Comments

1

I think the app you create with react-native will work with iOS but you might just have to develop it without an iOS SDK. (essentially, you can't really see the app in a virtual iOS device whilst developing).

However, i think if you develop the app for android using android studio SDK with react native, the app should also work with iOS as well. It's just that you won't really be able to see the app in development on a virtual iOS device.

Another option is to use expo when using react native. Essentially, it displays your app on your iphone so you can technically do app development whilst viewing the app on an iOS device, but I don't think its that great as you can only see it on your phone, whilst I prefer to use a virtual device on my laptop.

You can view documentation for expo in the react native docs here: https://facebook.github.io/react-native/docs/getting-started

I'd recommend you to just develop the app for android using the android SDK from Android studio. This also works with expo or react native CLI. Although you may have to develop the app in a virtual android device, I think the app also works with an iOS device (it may just look a little bit different e.g. a button in android will look different to a button on iOS)

Here's a tutorial that really helped me with learning React-Native: https://www.youtube.com/watch?v=NuZOwsmzcro Just follow the steps and make sure you install an android SDK. Then once you get to around "9:25", instead of starting up an iOS emulator from an iOS SDK, start up the android one from android SDK, then hit the button "a" to choose android and you're all set!

Comments

0

Namely, you can not run IOS Simulator on windows. But you can access a virtual IOS machine and run Simulator from windows virtually as a solution..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.