I was just starting to learn how to use Core Data
today, and ran into a problem when I had to subclass from NSManagedObject
in my objective-c project. I am following the Stanford class iOS 7 (I came from the Swift
background and want to learn more about objective-c
) Stanford University iOS 7 Application Development: Lecture 13 - Basic Data and Table View Here's what I've done so far:
First
Create my CoreDataModel.xcdatamodeld
file and configure my objects like this
Further
With the CoreDataModel.xcdatamodeld
file CoreDataModel.xcdatamodeld
I go to Editor
and try to subclass NSManagedObject
Four Swift files were created, including the empty header file MyProject-Bridging-Header.h
.
I have many compiler errors:
I am confused about why xcode will generate Swift
files for me instead of objective-c
one, since I already configured using objective-c
as my language.
How do I set up the header file so that objective-c
recognizes my Swift
files, or is there a way to create an objective-c
subclass file, such as a .m
and .h
file?
Re-allocation error may arise from code issue Generating an automatic Xcode subclass
My details were as follows:
Any suggestion is appreciated.
source share