简体   繁体   English

在 xcode 中打开 react native 项目

[英]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 .我有一个正在运行的 React Native 项目,我正试图在应用程序商店中获取它 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.按照这些说明,在 Apple Developer Dashboard 中创建我的配置文件后,它会提示双击开发人员配置文件以启动 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.现在找到您刚刚在计算机上下载的文件,依次双击每个文件,启动 Xcode。 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.所以我双击我的文件,xcode 启动但没有窗口打开。 I do not have an xcode project for my react native app so I have nothing to open.我没有用于我的本机反应应用程序的 xcode 项目,所以我没有任何东西可以打开。 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?如何从中获取 xcode 项目?

For normal (not expo) react-native cli projects:对于普通(非 expo)react-native cli 项目:

Run xed ios when inside your react-native project root directory.在你的 react-native 项目根目录中运行xed ios It opens Xcode at the ios directory.它在 ios 目录中打开 Xcode。 Or open ios/PROJECT_NAME.xcworkspace .或者open ios/PROJECT_NAME.xcworkspace xed is the Xcode text editor invocation tool . xedXcode 文本编辑器调用工具

I added this because even though the author uses expo, this question was first on my non-expo search results.我添加这个是因为即使作者使用 expo,这个问题在我的非 expo 搜索结果中排在第一位。 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.您可能会发现使用 Xcode 比直接编辑 PLIST、XML 或其他配置文件以及“存档”您的应用程序然后上传到 App Store 更方便。 I remember when I first learning React Native, and thought I wouldn't need to use XCode.我记得当我第一次学习 React Native 时,我认为我不需要使用 XCode。 I was very wrong.我错了。


For "fully managed" expo projects , you don't actually have access to the native code (ios or android files).对于“完全托管”的世博会项目,您实际上无权访问本机代码(ios 或 android 文件)。 To have access to/ modify the native code, you need to go into the 'bare workflow' .要访问/修改本机代码,您需要进入“裸工作流程”

Your're using Expo's ecosystem to build the app, you'll have to use Expo to build/publish it.您正在使用 Expo 的生态系统来构建应用程序,您必须使用 Expo 来构建/发布它。 You should check the expo's documentation .您应该查看博览会的文档

If you really want to build it from xcode you could run react-native eject to quit this ecosystem.如果你真的想从 xcode 构建它,你可以运行react-native eject来退出这个生态系统。 It'll create android and ios folders and you'll be able to build/publish your app manually.它将创建 android 和 ios 文件夹,您将能够手动构建/发布您的应用程序。

He please, to open the project in XCode, first you need generate the ios folder, for that use the cmd: react-native eject他拜托,要在 XCode 中打开项目,首先你需要生成 ios 文件夹,为此使用 cmd: react-native eject

Rgds Rgds

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM