简体   繁体   中英

CoreData NSManagedObject subclass - Expected identifier

When I generate my NSManagedObject from my data model, my header from the NSManagedObject is almost full red. It says "Expected ')'" and "Unexpected '@' in program". It's not just one header file, but all of them from the generated NSManagedObject.

Steps

  1. I create a new entity in my data model (Name and Class have the same name)
  2. I generate my NSManagedObject (New File -> Core Data -> NSManagedObject subclass)

When I follow these steps, the code of my header file turns red..

I use XCode 5.1.1 (5B1008). I has worked before, but suddenly I got these errors. I removed all CocoaPods just in case that caused these errors, but it didn't fix it.

Code header

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>


@interface Menu : NSManagedObject

@property (nonatomic, retain) NSString * mod_date_updated;
@property (nonatomic, retain) NSNumber * mod_id;
@property (nonatomic, retain) NSString * mod_name;
@property (nonatomic, retain) NSString * mod_route;

@end

Data model

在此输入图像描述

Errors

在此输入图像描述

Well... I solved my problem. I had a bracket somewhere in my main file on a place it shouldn't be.

So. My experience with this error is looking after some misplaced letters :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM