Alex Rivera | Logout

Array of NSManagedObject attributes

Asked 2010-11-15T18:28:09.770
9

I'd like to get an array of the attributes for my NSManagedObject so I can use KVO to export them. I can create an array manually and then iterate through it, however, I'd like to get this list automatically, then iterate.

Edit
Report

1 Answer

4

Thanks Joshua. Here's code that I used in case any one would like to see a hard example:

NSString *entityName = NSStringFromClass([myEntity class]);
NSEntityDescription *entityDescription = [self entityDescriptionWithEntityName:entityName];
NSDictionary *attributes = [entityDescription attributesByName];
NSArray *attributeNames = attributes.allKeys;
answered 2013-07-17T18:23:57.493

Your Answer