I just get started learning how to use Core Data
today and encountered an issue when I have to subclass from NSManagedObject
in my objective-c project. I'm following the Stanford iOS 7 class(I come from Swift
background and want to learn more about objective-c
) Stanford University Developing iOS 7 Apps: Lecture 13 - Core Data and Table View
Here is what I've done so far:
Create my CoreDataModel.xcdatamodeld
file, and configure my entities like this
With the CoreDataModel.xcdatamodeld
file highlighted, I go to the Editor
and try to create NSManagedObject
subclass
Four Swift files were created inclduing an empty bridging header file MyProject-Bridging-Header.h
.
I have a many compiler errors:
I'm confused about why the xcode will generate Swift
files for me instead of objective-c
one since I have already configured using objective-c
as my language.
How can I configure my header file to make objective-c
recognize my Swift
files or is there a way to create objective-c
subclass file instead, such as .m
and .h
file?
The redeclaration error may come from the the codegen issue Xcode automatic subclass generation
My drived data have the following files
Any suggestion is appreciated.
When you select your model in Project navigator, in File inspector you have an option to select the language in which code will be generated:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With