0
我有一个应用程序,它正在Core Data中使用和存储数据。我的数据模式如下所示:编辑核心数据项
我的客户请求修改Number(在Customer实体中)或'Rooms'(CustomerName除外)中的任何属性的能力。
我不确定从哪里开始。我做了一些Google搜索和搜索问题,但似乎找不到适合我需求的解决方案。
任何帮助或示例代码将不胜感激。
感谢
山姆
我有一个应用程序,它正在Core Data中使用和存储数据。我的数据模式如下所示:编辑核心数据项
我的客户请求修改Number(在Customer实体中)或'Rooms'(CustomerName除外)中的任何属性的能力。
我不确定从哪里开始。我做了一些Google搜索和搜索问题,但似乎找不到适合我需求的解决方案。
任何帮助或示例代码将不胜感激。
感谢
山姆
您可以用密钥值编码修改号码或通过访问其方法是直接
Customer* customer=[NSEntityDescription insertNewObjectForEntityForName:@"Customer" inManagedObjectContext:self.managedObjectContext];
customer.Number=[NSNumber numberWithInt:10];
if(![managedObjectContext save:&err])
NSLog(@"data cannot be saved");
您可以访问房间实体以类似的方式,这将作为NSSet *对象返回。 获取所需的对象并以类似的方式修改该值。
[https://developer.apple.com/library/mac/#documentation/cocoa/conceptual/coredata/Articles/cdRelationships.html](https://developer.apple.com/library/mac/#documentation /cocoa/conceptual/coredata/Articles/cdRelationships.html) – ggfela 2012-03-01 09:49:04