0

Is there another way to make this possible?

(Entity1*)[entity1attributes objectAtIndex:i] = [[groupOfAlphabetObjects objectAtIndex:i] objectAtIndex:idx];

where entity1attributes is an array containing strings like "e.abc1", "e.def1", etc.

Prior to this line, I have declared and initialized Entity1 by

Entity1 *e = [NSEntityDescription insertNewObjectForEntityForName:@"Entity1" inManagedObjectContext:context];

I need this because I run through many arrays and add them accordingly one string by one string to attributes in Entity1.

EDIT:

It is not only adding strings, I have also to set up one attribute to another Entity's relating attribute. So it is not possible to do this in "one's line adding" through NSDictionary or NSArray...

4

1 回答 1

1

您应该考虑使用 KVC,特别setValue:forKeyPath:是它允许您通过配置数据导航到实体及其关系中的其他实体的属性。

于 2013-08-23T11:29:39.977 回答