ma1*_*w28 2 core-data objective-c nsmanagedobject nsentitydescription nsattributedescription
我有一个User : NSManagedObject.获得NSAttributeDescription它的userID属性的最佳方法是什么?
假设您有权访问User *user实例,您可以:
NSAttributeDescription *userIDAttribute =
[[user.entity attributesByName] objectForKey:@"userID"];
Run Code Online (Sandbox Code Playgroud)
如果你没有访问User *user对象而只是访问对象NSManagedObjectContext *context,你可以获得NSEntityDescriptionfor User:
NSEntityDescription *userEntity = [NSEntityDescription entityForName:@"User"
inManagedObjectContext:context];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1114 次 |
| 最近记录: |