http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreDataUtilityTutorial/Articles/00_introduction.html
我刚刚开始,已经遇到了一个错误(很可能是我的错误,而不是其他人的错误)。
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import <objc/objc-auto.h>
NSManagedObjectModel *managedObjectModel();
int main (int argc, const char * argv[]) {
objc_startCollectorThread();
return 0;
}
NSManagedObjectModel *managedObjectModel() {
static NSManagedObjectModel *mom = nil;
if(mom != nil){
return mom;
}
mom = [[NSManagedObjectModel alloc] init];
// implimentation continues
return mom;
}
我得到一个错误:
“\u OBJC\u CLASS\uu NSManagedObjectModel”,引用自:
CoreDataUtility.o中NSManagedObjectModel的objc类引用
我猜这个问题是由managedObjectModel()函数的前向声明引起的,但是我无法解决为什么会出现这个问题。