开发者

ISO C++ forbids declaration of 'NSPersistentStoreCoordinator' with no type

I have .mm file that I want under function to work with core data

// in header file

/*Saving parameters*/
NSManagedObjectModel *managedObjectModel;
NSManagedObjectContext *managedObjectContext;       
NSPersistentStoreCoordinator *persistentStoreCoordinator;

NSManagedObjectContext *context = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];


NSManagedObjectContext *context = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];


/* 1. Check if employee exists*/


NSEntityDescription *employeeentity = [NSEntityDescription 
                               entityForName:@"employees" inManagedObjectContext:context];
[fetchRequest setEntity:employeeentity];
NSError *error;
NSArray* employee_info = [context executeFetchRequest:fetchRequest error:&error];


if (employee_info !=nil) {

    NSLog(@"employee Exist");



}
else {

    NSLog(@"employee NOT Exist")开发者_如何学运维;

}

I use mm because I work with cpp also any suggestion please

Best regards


I am not a C++ guy at all. But if I'm allowed to make an educated guess:

For me it sounds like the compiler does not know what NSPersistentStoreCoordinator is.
So you should include the header <CoreData/CoreData.h> or tell him that this class exists with the C++ equivalent of @class NSPersistentStoreCoordinator

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜