OK、これが私のテストクラスのコードです:
- (NSManagedObjectContext*)managedObjectContextWithConcurrencyType:(NSManagedObjectContextConcurrencyType)concurrencyType {
NSManagedObjectModel *mom = [NSManagedObjectModel mergedModelFromBundles:nil];
STAssertNotNil(mom, @"Can not create MOM from main bundle");
NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mom];
STAssertNotNil(psc, @"Can not create persistent store coordinator");
NSPersistentStore *store = [psc addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:0];
STAssertNotNil(store, @"Can not create In-Memory persistent store");
NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] initWithConcurrencyType:concurrencyType];
moc.persistentStoreCoordinator = psc;
return moc;
}
そして、テストメソッドでメソッドを使用しようとしたときの失敗メッセージは次のとおりです。
Undefined symbols for architecture i386:
"_NSInMemoryStoreType", referenced from:
-[CrosswordItemTests managedObjectContextWithConcurrencyType:] in CrosswordItemTests.o
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in CrosswordItemTests.o
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in CrosswordItemTests.o
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in CrosswordItemTests.o
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in CrosswordItemTests.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
そのような必要なクラスを.hファイルにインポートしたと思いました。
#import <CoreData/CoreData.h>
私は何が欠けていますか?