English 中文(简体)
核心数据——关系
原标题:Core Data - Relationships

我进口了三个核心数据实体:

• sizes (Name, Clothes (one to many with "Clothes" entity))
• Clothes (Name, Price, etc... +2 relationships)
• shop (Name, Clothes (one to many to "Clothes" entity))

我将商店、商店和大小进口到规模的实体。

现在我进口衣服。 在一开始,我就大小和商店申请,将其储存到一个阵列。

我正在穿过所有的衣服,把字典活着,然后,我以商店名称和面积的阵列为准,以获得每个被管理的物体,然后试图并储存这种与关系不相干的物品?

如果是我的话,它会做些什么?

预示我不能以任何其他方式获得正确管理的物体,有什么错误?

还是有另一种方式来建立这种关系?

Thanks James

http://www.ohchr.org。


我有这样的办法,来获取/解释商店:

- (void) getShops {

NSManagedObjectContext *moc = [(ImportingAppDelegate *) [[UIApplication sharedApplication] delegate] managedObjectContext]; 

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];

[fetchRequest setEntity:[NSEntityDescription entityForName:@"Shop" inManagedObjectContext:moc]];

NSError *error;
arr_Manufacturers = [moc executeFetchRequest:fetchRequest error:&error];

NSLog(@"get: %@", [arr_Shops count]);

[fetchRequest release];
}

- (id) getShop:(NSString *)name {

NSPredicate * predicate = [NSPredicate predicateWithFormat:@"Shop = %@", name];
return [arr_Shops filteredArrayUsingPredicate:predicate];

}

然后,在试图储存时做到:

 moc_Clothes.Shop = [self getShop:@"Shop Name Variable"];
最佳回答
问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签