I'm working with Swift in Xcode and I receive the following error:
Value of type 'Category' (aka 'OpaquePointer') has no member 'name'
And I've looked everywhere but I can't find a solution. Does someone know what to do?
I'm working with Swift in Xcode and I receive the following error:
Value of type 'Category' (aka 'OpaquePointer') has no member 'name'
And I've looked everywhere but I can't find a solution. Does someone know what to do?
On
I also had this occur when attempting the exercise in the Angela Yu course where Category is a core data entity. I was using Xcode 11.3.1. After several attempts of setting the Module to Current Product Module and Codegen to Class Definition followed by Ctrl-B's to rebuild, I still received the error. However, restarting Xcode solved the problem and code completion was then able to suggest the name attribute/property.
On
Also in Angela's class. I found that by removing the core data models and reinitiating them as independent entities with no relationship, setting up the save and load functions, running the app, and then going back to link the relationship solved the issue. I think it has to do with saving the entities as NSManagedObject before being able to reference the attributes. I am guessing that without initiating them as an NSManagedObject the default type is Opaque Pointer. Best of luck!
On
Change the 'categories' variable form 'var' to 'let'.
From,
var categories = [Category]()
to
let categories = [Category]()
Just re-build it and this is working.
On
I'm following the same lesson. In my case was just an Xcode bug and "Category" was not recognized as a class. I just close and re-open it and work fine.
On
If [Category]() is not recognized as a NSManagedOject, just put the term Category between two single reversed quotation marks inside the brackets.
On
I had the same problem. In my DataModel file, I changed entity name and the class name from "Category" to different one, such as "TodoListCategory." Then in my CategoryViewController, I changed all the Category objects to "TodoListCategory" and rebuild. It solved my problem.
After that, you might have error "Command CompileSwift failed with a nonzero exit code." Now, try to clean your project by using Shift + Command + K & Option + Shift + Command + K
On
While declaring a array of the type Category, do it like :
var categories = [[`Category`]]()
(if you have the name of the entity as "Category")
note: There is just a single back tick to the left of category.
On
Good day!
Please make sure you did not choose Opaque Pointer instead of your Class. See below:
if you did, replace Category with 'Category'
On
I had same issue while been going through Angela Yu course and I had tried all of the available solution which I could find, but only this one has helped to me: while your project is opened:
do not use hotkey combination - just press it with your mouse! only this method help to me to get rid of this error.
Category did not provide name property