Core data 将CoreData对象导出到NSDictionary或NS数组中
我有一个核心数据对象,它由不同类型的NSString、Float、NSDATA等组成Core data 将CoreData对象导出到NSDictionary或NS数组中,core-data,nsmutablearray,nsarray,nsdictionary,Core Data,Nsmutablearray,Nsarray,Nsdictionary,我有一个核心数据对象,它由不同类型的NSString、Float、NSDATA等组成 <Shoplog: 0x9c78d20> (entity: Shoplog; id: 0x9c77050 <x-coredata://828289C5-E1B8-48A6-B2A0-F68B7DF21F2E/Shoplog/p5> ; data: { categoryname = Ines; comments = nil; date = nil; em
<Shoplog: 0x9c78d20> (entity: Shoplog; id: 0x9c77050 <x-coredata://828289C5-E1B8-48A6-B2A0-F68B7DF21F2E/Shoplog/p5> ; data: {
categoryname = Ines;
comments = nil;
date = nil;
email = "iloveyou@gmail.com";
image = <ffd8ffe0 00104a46 49460001 01000001 00010000 ffe10058 45786966 00004d4d 002a0000 00080002 01120003 00000001 0001>;
phone = 800;
price = 9988;
shop = "";
websiteurl = "http://www.google.com";
})
它给了我一个非常小的文件135字节,无论所选的NSManagedObject有多大,我都会得到相同的大小
我需要帮助来了解出了什么问题?
我想到了1个解决方案:
1-使用KVC方法将NsManagedObject传输到NSMutableArray
虽然我仍然相信这个问题有一个更聪明的解决方案,所以如果有人能帮助我,我将不胜感激
谢谢我在下面的链接中有我的答案,很容易实现,只需按照步骤操作即可
我在下面的链接中有我的答案,它很容易实现,只需按照步骤操作即可
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"Shoplog.slog"];
[savedData writeToFile:filePath atomically:YES];