All the CoreData header files is imported App_Prefix.pch
in, so the CoreData classes would be available throughout your Project, so You don't have to manually import the header in the files you need them.
So open up Xcode and look for some file like App_Prefix.pch
, by default it's in the Other Sources
group. After UIKit
the import statement, add the following line:
#import <CoreData/CoreData.h>
And you should is ready to go.
Xcode 4
For projects created in Xcode 4, the prefix file can is found in the Supporting Files
group in the Project Navigator. It ' s called 'projectname-prefix.pch ' by default.
See Http://stackoverflow.com/questions/2032818/adding-core-data-to-existing-iphone-project
PS: Nsmanagedobjectcontext, which was previously returned as a function parameter type, did not report an error, but when [[Nsmanagedobjectcontext alloc] init], it was suddenly reported that the title was wrong, Let me not associate to the header file to refer to that piece, but in fact, it is not a reference to the first file, still feel a bit strange.
Receiver ' Nsmanagedobjectcontext ' for class message is a forward declaration wrong solution