106

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

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

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

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

Cesare
  • 9,139
  • 16
  • 78
  • 130
Snowcrash
  • 80,579
  • 89
  • 266
  • 376

20 Answers20

335

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

EDIT: You may need to delete from .xcodeproj file and .xcworkspace file

Abhishek Bedi
  • 5,205
  • 2
  • 36
  • 62
Chris Miles
  • 7,346
  • 2
  • 37
  • 34
  • I've been using a very nice app called Watchdog. It automatically kills xcuserdata on clean or shutdown. You can buy it from the MAS for a couple of bucks. – SmileBot Jan 12 '15 at 04:06
  • I have deleted all three folders under xcuserdata, that worked for me, thanks – Yunus Nedim Mehel Apr 13 '15 at 11:49
  • 12
    Works even on a [cocoapods](https://cocoapods.org/) based project - where open the `.xcworkspace` file instead of the `.xccodeproj`. Removing the `xcuserdatad` leads to a working `.xcworkspace `file as well – ilmgb Aug 14 '15 at 11:39
  • ops, I deleted the .xcodeproj file accidentally, please remove xcuserdata from .xcodeproj, right click on the .xcodeproj and open show packages. – Naveed Ahmad Aug 26 '17 at 05:52
  • Switched from npm to yarn and this has helped. – Vladimír Slavík Sep 07 '17 at 15:18
  • it worked in me in Xcode 11.4, Cocoapods version 1.9.1. But i had to remove the .xcuserdatad file BEFORE running "pod install" command. – samin.yasar Apr 12 '20 at 06:19
  • Worked to me too! Xcode 11.6 - after build failed following accidentally deleting another file too. Huge thanks – B_A_W Aug 06 '20 at 21:26
  • Xcode 12.5. Delete this file`.xcuserdatad` fix my problem. Thanks! I met this when I switch my git commit to an old commit. – Zhou Haibo Jul 06 '21 at 16:01
  • Years later, Version 13.3.1 (13E500a), this is still apparently how it is done. – Henrik May 16 '22 at 13:20
90

This worked for me

  1. Click on No Scheme
  2. Click on Manage Scheme
  3. Click on Autocreate Schemes Now
gabo
  • 1,133
  • 8
  • 7
27

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

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

Dhanas Manian
  • 504
  • 4
  • 6
13
  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

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

Szuwar_Jr
  • 683
  • 8
  • 11
  • Still the best solution for Xcode 12.4 if the .xcworkspace is completely broken. I also suggest doing `pod deintegrate` before doing `pod init` then `pod install`. – Eric Aya Apr 03 '21 at 11:28
8

Use shortcut ctrl+cmd+[ or restart.

pbaranski
  • 22,778
  • 19
  • 100
  • 117
7

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

.xcodeproj or .xcworkspace file and select Show Package Content

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

  • If it do not work and you have CocoPod in your project run the following Command

Pod install

Sultan Ali
  • 2,497
  • 28
  • 25
6

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.

Ron Myschuk
  • 6,011
  • 2
  • 20
  • 32
5

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.

Hajji Daoud
  • 157
  • 1
  • 8
5

Firstly,when you are using Cocoapods to Develop iOS projects,you need to open the project with .xcodeworkspace file instead of .xcodeproj file.

enter image description here

Secondly you can Show Package Contents with .xcworkspace file,you will find the contents.xcworkspacedata file.

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>

pay attention to this line:

location = "group:BluetoothColorLamp24G.xcodeproj"

The .xcworkspace file has reference with the .xcodeproj file.

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

Development Environment:
macOS 10.14 Xcode 10.1

ifeegoo
  • 7,054
  • 3
  • 33
  • 38
4

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

temp_
  • 1,238
  • 2
  • 12
  • 24
1

I will add to this answer::: From @Chris Miles.

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

Close Xcode, and everything, about ios development like simulators, then run again you pod install if you are using cocoa pods.

That's works for me.

1

This answer is for people who tried everything in the answers and still did not fix the issue:

Your solution is git checkout mainline. Because you probably played around with xcodeproj file and its broken now..

Will Gwo
  • 403
  • 3
  • 6
1

I have Removed pod completely from my project and adding it again.. retrieved my target and all

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
1

In my case the cause was renaming the project so I went to Manage Schemas and created the App Schema again (+ button).

CristianMoisei
  • 2,071
  • 2
  • 22
  • 28
1

In my case I missed }; in project.pbxproj after resolving conflicts

1

If you change the Major Name Change off/in your project in the past and after that deleted the Xcode and its data, You will see this issue. When You will clone this project on other device.You will see same issue. To fix this, go to your pod file, update the target name and install the pods again.

AsifHabib
  • 944
  • 9
  • 25
0

None of the above worked for me. My solution was to look at the project file differences in text mode and I found that VALID_ARCHS got reset in two places (VALID_ARCHS = ""). Restoring the proper settings for VALID_ARCHS, also restored back the Schemes.

Eray Balkanli
  • 7,752
  • 11
  • 48
  • 82
0

This commonly occurs when you install a Cocoapod, and try building and running from your workspace without first closing your project. If this is the case, quit Xcode, then open your app from your workspace and it should be fine.

ScottyBlades
  • 12,189
  • 5
  • 77
  • 85
0

In my case I rebranched to develop and then the window appeared if I want to resave my project. I must have clicked "close" though. Anyways, I lost my scheme and what helped was rebranching to some other branch, then back to develop and resave how I was supposed to do in the first place

aleksy.t
  • 267
  • 2
  • 18
0

Try this very simple steps:

  • Xcode menu "Product"
  • Scheme
  • Select another scheme
Medhi
  • 2,656
  • 23
  • 16