在 xcode 中打开 React Native 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52043147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Open react native project in xcode
提问by smilebomb
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:
我确定我错过了一些简单的东西。我有一个 React Native 项目正在运行,我正试图在应用程序商店中获取它。按照这些说明,在我在 Apple Developer Dashboard 中创建我的配置文件后,它说双击开发人员配置文件以启动 xcode。正是这些说明:
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.
现在找到您刚刚在计算机上下载的文件,然后依次双击每个文件,从而启动 Xcode。通过打开一个项目或为此测试启动一个新项目来验证配置文件是否存在。
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.
所以我双击我的文件,xcode 确实启动了,但没有打开任何窗口。我的 React Native 应用程序没有 xcode 项目,所以我没有任何东西可以打开。没有“构建设置”或“常规”菜单,所以我不确定如何进行。
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 项目?
回答by Ben B
For non-expo projectsaka. react-native cli projects:
对于非世博项目又名。react-native cli 项目:
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 ios
你的反应本地项目的根目录里面的时候。它会在 ios 目录中打开 XCode。或者open ios/PROJECT_NAME.xcworkspace
I added this because even though the author uses expo, this question was first on my non-expo search results.
我添加这个是因为即使作者使用了expo,这个问题也是我的非expo搜索结果中的第一个。
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'.
对于“完全托管”的博览会项目,您实际上无权访问本机代码(ios 或 android 文件)。要访问/修改本机代码,您需要进入“裸工作流”。
回答by sanjar
Your're using Expo's ecosystem to build the app, you'll have to use Expo to build/publish it. You should check the expo's documentation.
您正在使用 Expo 的生态系统来构建应用程序,您必须使用 Expo 来构建/发布它。您应该查看博览会的文档。
If you really want to build it from xcode you could run react-native eject
to quit this ecosystem.
It'll create android and ios folders and you'll be able to build/publish your app manually.
如果你真的想从 xcode 构建它,你可以运行react-native eject
退出这个生态系统。它将创建 android 和 ios 文件夹,您将能够手动构建/发布您的应用程序。
回答by Yoandy Pérez Villazón
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