Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open react native project in xcode

I'm sure I'm missing something simple. I have a React Native project working and I'm attempting to get it on the app stores. Following those instructions, after I have created my provisioning profile in the Apple Developer Dashboard, it says to double click the developer provisioning profile to launch xcode. It's these instructions exactly:

Now find the files you just downloaded on your computer, and double-click each of them in turn, causing Xcode to launch. Verify the profiles are there by opening a project or starting a new one for this test.

So I double-click my file, and xcode does launch but no windows open up. I do not have an xcode project for my react native app so I have nothing to open. There is no menus for 'build settings' or 'general' so I'm not sure how to proceed.

For reference, here is my react native directory structure:

my_project/
    .expo/
    assets/
    node_modules/
    src/
    .bablerc
    .gitignore
    App.js
    app.json
    package-lock.json
    package.json
    README.md

Did I miss a step somewhere? How do I get an xcode project from this?

like image 777
smilebomb Avatar asked Aug 27 '18 16:08

smilebomb


People also ask

Can I open React Native project in Xcode?

If you are already familiar with mobile development, you may want to use React Native CLI. It requires Xcode or Android Studio to get started. If you already have one of these tools installed, you should be able to get up and running within a few minutes.

How do I run React Native app in Xcode?

Plug in your device via USB​ xcworkspace , within it using Xcode. If this is your first time running an app on your iOS device, you may need to register your device for development. Open the Product menu from Xcode's menubar, then go to Destination. Look for and select your device from the list.

How do I open a project in Xcode?

Importing into XcodeOpen Xcode and select Open Another Project or File, Open. Open the folder you unzipped from your Dropsource download and locate the file with “. xcodeproj” extension in the root directory. Select the file and click Open.

Do I need Xcode to build a React Native App?

If you intend to run it on an iOS device or simulator, the use of Xcode is often required. You can build a React Native app either using the React Native CLI, which allows you to run build commands from your terminal, or Xcode. I prefer to use Xcode for the following reasons:

How do I run XED in React Native?

Run xed ios when inside your react-native project root directory. It opens Xcode at the ios directory. Or open ios/PROJECT_NAME.xcworkspace. xed is the Xcode text editor invocation tool. I added this because even though the author uses expo, this question was first on my non-expo search results.

What is the best way to get started with React Native?

If you are new to mobile development, the easiest way to get started is with Expo CLI. Expo is a set of tools built around React Native and, while it has many features, the most relevant feature for us right now is that it can get you writing a React Native app within minutes.

How do I run react-native apps on iOS devices?

npx react-native run-ios is one way to run your app. You can also run it directly from within Xcode. If you can't get this to work, see the Troubleshooting page. The above command will automatically run your app on the iOS Simulator by default. If you want to run the app on an actual physical iOS device, please follow the instructions here.


1 Answers

For normal (not expo) react-native cli projects:

Run xed ios when inside your react-native project root directory. It opens Xcode at the ios directory. Or open ios/PROJECT_NAME.xcworkspace. xed is the Xcode text editor invocation tool.

I added this because even though the author uses expo, this question was first on my non-expo search results. You might find using Xcode more convenient than editing PLIST, XML or other configuration files directly, as well as 'archiving' your application to then upload onto the App Store. I remember when I first learning React Native, and thought I wouldn't need to use XCode. I was very wrong.


For "fully managed" expo projects, you don't actually have access to the native code (ios or android files). To have access to/ modify the native code, you need to go into the 'bare workflow'.

like image 186
Ben Butterworth Avatar answered Sep 19 '22 03:09

Ben Butterworth