1

In XCode 11.1, I see

No MacOS or iOS targets found

message when my project name is selected in in the Project Navigator and when "Info" tab is selected in the right pane.

enter image description here

Also, the title of "scheme button" is "No scheme" at the top right of XCode, at the right of Play and Stop buttons. When I click "Autocreate schemes now" button as suggested here, nothing happens. Schemes window is completely empty.

I think this weird situation occurred after I reinstalled macOS Catalina (10.15.1) to my Mac and built my app for the first time for my iPhone by using a USB connection. Before that I was using iOS simulator all the time and this was a working project on simulators. It is using Cocoapods.

To solve the problem, I have tried many things.

First of all I thought that it might be related to cocoapods, so I have reinstalled cocoapods to my Mac. I installed it without sudo by --user-install paramater. I have changed the $PATH variable of my Mac's zsh shell too. But this did not solve this problem.

Then I have tried to use pod update or pod install commands but I received following error:

[!] Unable to find a target named MyApp in project MyApp.xcodeproj, did find .

Then I removed cocoapods altogether from the project by using pod deintegrate and pod clean commands but this did not solve the problem either.

I also deleted the folder .xcuserdatad from within .xcodeproj/xcuserdata/ as suggested here but it did not help either.

I have spent hours on this frustrating problem and I don't mind creating a new project from scratch if that's the way to solve this. But I want to keep my source control history as it is.


Update: I am not sure if this is a proper way to solve this, but still I have tried to click Plus ("Add a target") button:

enter image description here

Then I selected iOS -> Single View App, which was the template when I created this project. Now this "No targets" error is gone, project has targets and I can see simulators in schemes. However, when I run the project for a simulator, I only get a blank (white) screen in the app. I reinstalled pods without problem, but I still get only a white screen in the app on simulator...

I noticed that a new project folder has been created and it is seen in the Project Navigator. There is a new Main.storyboard there, so basically clicking "Plus" button and adding a target caused this... Now my old project files are ignored... ‍♂️


Last update:

I have restored the project from a backup that I created before I reinstalled my Mac. It seems that this solved my problem. I will not delete this question just in case it might get an answer and it might help someone.

Luke
  • 965
  • 8
  • 21
  • 1
    If it makes you feel better, this recently happened to one of my new projects, too. It’s a weird, incredibly annoying, and serious Xcode bug (in Catalina & Xcode 11.1, IIRC). Unfortunately, I’ve been unable to reproduce the problem, so I haven’t yet filed a bug report yet. (FWIW, I just recreated the project and added the sources back in.) – Rob Nov 06 '19 at 01:41
  • @Rob Thanks Rob, it made me feel better. I humbly advice to all newbies like me to keep recent backups of their hard work all the time. Sometimes restoring a backup is the best way than spending hours to solve a weird problem you don't even understand. – Luke Nov 06 '19 at 01:47
  • 1
    It's great that you solved it; I would recommend that you put your answer as an answer, not as an update to the question. That is the best way to help future readers of Stack Overflow! Doing this will not discourage other answers. – matt Nov 06 '19 at 01:49

3 Answers3

2

The way to solve this problem for me was restoring a backup which was created before I reinstalled my macOS Catalina. This solved all my problems instantly.

Another way to go might be creating a new project and adding source files in there, as Rob did.

It seems adding a new target to an existing project causes already existing source files in the project to be ignored and new source files are being created, so this is not a way to solve this problem.

PS: This answer is written by the suggestion of matt.

Luke
  • 965
  • 8
  • 21
  • Yep, you should always feel free to [answer your own question](https://stackoverflow.com/help/self-answer)! – Rob Nov 06 '19 at 07:51
0

You need to plug in the device or have logged into it (connected to it)..then it shows up here: https://developer.apple.com/account/resources/devices/list

You can also add devices there..you need to click reset to be able to add a new device. the reset button should be labeled modify because it doesn't reset anything.

for example, if you need to make a tvOS app then you need to have an apple TV in the device list. Once you add that then you're good to go. kisses.

0

The common reason for this issue is accidentally selecting the wrong target/template when creating a project, ie I if you select your template as tVOS then you will have that issue. Refer to the screenshots below: -

1. Wrong

tvOS target

2. Correct (If you want to build for iOS)

enter image description here

That's it, make sure you select the correct template, which I think if you need to create for all Apple Ecosystem you should select the last tab (Cross-platform).

Mussa Charles
  • 4,014
  • 2
  • 29
  • 24