Custom Master Data Objects

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?

+3
source share
3 answers

The best way is to use the attribute 'transformable'. For more information, see the master data documentation:

Custom persistent attributes

+1
source

NSCoding, Transformable Attributes. Apple pf :

- , Core Data NSValueTransformer NSData. .

+1

, , NSData​​p >

, UIImage NSData​​p >

UIImage *img = [UIImage imageNamed:@"some.png"];

NSData *dataObj = UIImageJPEGRepresentation(img, 1.0);

[dataObj writeToFile:fileName atomically:YES];

fileName -

-2

All Articles