Hi, I’m in the second tutorial of iOS Apprentice V6, Checklists. At chapter 14, when I have refactored the code by change the AddItemViewController to ItemDetailViewController.
I have this red error after I cleaned product, restart Xcode 9.1, even restart the computer. In the tutorial it said “restarting your computer is the last resort. That does get rid of even the most stubborn issues.”, but I still got this:
Could anyone help me resolve this please?
It looks as if the refactoring did not work correctly for some reason since you appear to have code referencing both
ItemDetailViewController but as far as the errors indicate, a class by neither name could be found in your project.
The first thing to do would be to see if you have either a file named AddItemViewController.swift or ItemDetailViewController.swift in your project. You should see this in your Project navigator. Or, you can simply post a screenshot of the Project navigator here and I can see if I can spot what is going on.
Hi, thanks for reply.
The problem is that, I even can’t open the
ItemDetailViewController.swift in my Project Navigator, the name is displayed in red color, and when I click the
ItemDetailViewController.swift in Project Navigator, the main view window is still stay in the last file I was in, in this screenshot -
ItemDetailViewController.swift just didn’t show up…
Ah, the file in red means that the file does not exist. Xcode probably ran into problems renaming the old file. So what you need to do is select the red
ItemDetailViewController.swift file and tap Delete. That will remove the file from the project.
Then right-click on the Checklists folder (the yellow one) in the Project navigator and you should see a list of files in the project. Most of them should be greyed out since they are already part of the project. But there should also be one which is not greyed out, select that to add that to the project. If that file is still named
AddItemViewController.swift then you might have to rename that to
ItemDetailViewController.swift. Otherwise, you might be good to go.
Let me know how it goes.
The Problem is resolved, thanks very much!
This topic was automatically closed after 166 days. New replies are no longer allowed.