Xcode:没有方案

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21755799/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:04:13  来源:igfitidea点击:

Xcode: No Scheme

xcode

提问by Snowcrash

I recently opened project in Xcode is now saying I have No Scheme: enter image description here

我最近在 Xcode 中打开的项目现在说我有No Scheme在此处输入图片说明

When I try and Manage SchemesI am unable to Autocreate Schemes Now(a separate post but possibly related) and no Schemes are listed: enter image description here

当我尝试Manage Schemes但我无法Autocreate Schemes Now(单独的帖子但可能相关)并且未列出任何方案时: 在此处输入图片说明

and when I try and add a Scheme I get dialog saying Target None. enter image description here

当我尝试添加一个 Scheme 时,我得到对话框说Target None. 在此处输入图片说明

What's going on and how do I fix my Xcode project?

发生了什么,我该如何修复我的 Xcode 项目?

回答by Chris Miles

Close Xcode and delete the folder <username>.xcuserdatadfrom within <projectname>.xcodeproj/xcuserdata/. Then restart Xcode, the schemes should re-appear.

关闭 Xcode 并<username>.xcuserdatad<projectname>.xcodeproj/xcuserdata/. 然后重新启动 Xcode,方案应该会重新出现。

EDIT:You may need to delete from .xcodeprojfile and .xcworkspacefile

编辑:您可能需要从.xcodeproj文件和.xcworkspace文件中删除

回答by gabo

This worked for me

这对我有用

  1. Click on No Scheme
  2. Click on Manage Scheme
  3. Click on Autocreate Schemes Now
  1. 点击无计划
  2. 点击管理方案
  3. 单击立即自动创建方案

回答by Dhanas Manian

I think this is happening when you are opening the app.xcworkspace not app.xcodeproj.

我认为当您打开 app.xcworkspace 而不是 app.xcodeproj 时会发生这种情况。

Solution: Install the pod and open the app.xcworkspace again.

解决方法:安装pod,再次打开app.xcworkspace。

回答by pbaranski

Use shortcut ctrl+cmd+[or restart.

使用快捷键ctrl+ cmd+[或重启。

回答by Ron Myschuk

The top answer fix didn't work for me when running the Xcode 8 beta's. but what did work was unplugging a connected device (iPhone, iPad etc.) and re plugging back in. The schemes would then reappear.

运行 Xcode 8 beta 时,最佳答案修复对我不起作用。但有效的是拔掉连接的设备(iPhone、iPad 等)并重新插入。然后这些方案会重新出现。

回答by Sultan Ali

For me following worked
Go to your Project Directory and right click on the

对我而言,以下工作
转到您的项目目录并右键单击

.xcodeproj or .xcworkspace file and select Show Package Content

.xcodeproj 或 .xcworkspace 文件并选择显示包内容

and delete xcuserdata.
don't forget to restart the Xcode

并删除xcuserdata
不要忘记重新启动Xcode

  • If it do not work and you have CocoPod in your project run the following Command
  • 如果它不起作用并且您的项目中有 CocoPod,请运行以下命令

Pod install

Pod 安装

回答by Hajji Daoud

If you are using pods and using the correct workspace what I found to work best is simply open up terminal run pod update restart Xcode and every time it fixed the problem for me.

如果您正在使用 pod 并使用正确的工作区,我发现最有效的方法是打开终端运行 pod update 重新启动 Xcode,每次它为我解决问题时。

回答by Szuwar_Jr

  1. Close Xcode ["Force Quit Applications" (cmd+option+escape) to ensure]
  2. Remove derived data of app (Xcode 9.4: Users/[username]/Library/Developer/Xcode/DerivedData/[app directory to delete])
  3. Remove .xcworkspace from project directory
  4. Also in project directory: .xcodeproj -> Right Click -> Show Package Contents -> remove .xcworkspace if exist -> xcuserdata -> remove [username].xcuserdatad
  1. 关闭 Xcode [“强制退出应用程序”(cmd+option+escape) 以确保]
  2. 删除应用程序的派生数据(Xcode 9.4:Users/[用户名]/Library/Developer/Xcode/DerivedData/[要删除的应用程序目录])
  3. 从项目目录中删除 .xcworkspace
  4. 同样在项目目录中:.xcodeproj -> 右键单击​​ -> 显示包内容 -> 删除 .xcworkspace 如果存在 -> xcuserdata -> 删除 [用户名].xcuserdatad

It should do the trick. Install pods if needed and open project. Target should be available again.

它应该可以解决问题。如果需要,安装 pods 并打开项目。目标应该再次可用。

回答by ifeegoo

Firstly,when you are using Cocoapods to Develop iOS projects,you need to open the project with .xcodeworkspacefile instead of .xcodeprojfile.

首先,当你使用 Cocoapods 开发 iOS 项目时,你需要用.xcodeworkspace文件而不是.xcodeproj文件打开项目。

enter image description here

在此处输入图片说明

Secondly you can Show Package Contentswith .xcworkspacefile,you will find the contents.xcworkspacedatafile.

其次,您可以Show Package Contents使用.xcworkspace文件,您将找到该contents.xcworkspacedata文件。

enter image description here

在此处输入图片说明

<?xml version="1.0" encoding="UTF-8"?> <Workspace version = "1.0"> <FileRef location = "group:BluetoothColorLamp24G.xcodeproj"> </FileRef> <FileRef location = "group:Pods/Pods.xcodeproj"> </FileRef> </Workspace>

<?xml version="1.0" encoding="UTF-8"?> <Workspace version = "1.0"> <FileRef location = "group:BluetoothColorLamp24G.xcodeproj"> </FileRef> <FileRef location = "group:Pods/Pods.xcodeproj"> </FileRef> </Workspace>

pay attention to this line:

注意这一行:

location = "group:BluetoothColorLamp24G.xcodeproj"

location = "group:BluetoothColorLamp24G.xcodeproj"

The .xcworkspacefile has reference with the .xcodeprojfile.

.xcworkspace文件具有与该.xcodeproj文件的参考。

If you find there is no file or wrong path about the location,you can link to your .xcodeprojfile,which works for me.

如果您发现该位置没有文件或路径错误,您可以链接到您的.xcodeproj文件,这对我有用。

Development Environment:
macOS 10.14 Xcode 10.1

开发环境:
macOS 10.14 Xcode 10.1

回答by temp_

For me, I switched to a different Macbook. Running pod updatefixed everything for me.

对我来说,我换了另一台 Macbook。跑步pod update为我解决了一切。