How to create a Core Data Entity object that has custom objects in it?
eg. An object that has the ability to hold, for example. Images, sound clips, custom godzilla object.
How are they saved and loaded? Using NSData?
The best way is to use the attribute 'transformable'. For more information, see the master data documentation:
Custom persistent attributes
NSCoding, Transformable Attributes. Apple pf :
- , Core Data NSValueTransformer NSData. .
, , NSDatap >
, UIImage NSDatap >
UIImage *img = [UIImage imageNamed:@"some.png"]; NSData *dataObj = UIImageJPEGRepresentation(img, 1.0);
[dataObj writeToFile:fileName atomically:YES];
fileName -