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.
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 projectMyApp.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:
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.