简体   繁体   中英

Xcode Swift Autocomplete Failure <<error type>>

When declaring an outlet, the AutoCompleter outputs "error type". The outlet also loses properties. Deleting derived data and some files in Xcode project's packet did not help.

Example:

example

To avoid this issue you should to update the project's cash which Xcode generates for every project. To do that, go to

/Users/UserName/Library/Developer/Xcode/DerivedData

directory and remove

ModuleCache

directory from there.

After you do that, quit from Xcode and open your project again. Xcode will rebuild project index and error should be out.

You should also ensure that the class you are having an issue autocompleting is listed in the "Compile Sources" build phase for your target. I've had several occasions where source files mysteriously disappear - with the same result you are seeing.

An Xcode restart fixed this problem for me.

I had a very similar problem. When I used dot.notation to drill into a Class Instance I created, the autofill did not recognize the types for each property. The class property in question was explicitly defined as a String? [Optional] Type.

I expected the autofill to show that:

myInstance.name is of type "String?"

but the autofill said that:

myInstance.name is of type "error".  This appeared:  "<< error type >>"

A restart of Xcode, to my surprise, fixed the problem.

Maybe, the restart effectively did the "resetting" techniques others posted here. Looks like a performance or refresh issue on Xcode's part. Things running smoothly now.

Note: If you can reference your class fine in other places the file where you call the "error" class is the issue, not the "error" class itself. The only thing that works for me is deleting (removing reference) the file that references the "error" class and adding the file back to the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM