I have a Core Data Object Which is Composed of Different Types 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;
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";
})
The issue is i want to Export this NSManaged Object into an NSArray or NSDictionary in order to write it to a file , in order to send it by mail to another User , & Open it from His App.
So Whenever i am Trying to use this Code
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"Shoplog.slog"];
[savedData writeToFile:filePath atomically:YES];
It Gives me a very small File 135bytes no matter how big is the Selected NSManagedObject i get the same Size .
i need help to understand what is going on wrong ?
I think about 1 Solutions :
1- Transfer the NsManagedObject to NSMutableArray using KVC Method
Although i still Believe there is a smarter Solution for this Problem , so if someone can help i will be Grateful.
Thank you
I have my Answer in the Following Link , It is Very Easy to Implement, Just follow the Steps
Serializing (Archiving/Unarchiving) an NSManagedObject Graph