Database Reference
In-Depth Information
When you enable Allows External Storage , Core Data heuristically decides on a
per-value basis if it should save the data directly in the database or store a URI that
points to a separate file.
Note: The Allows External Storage option is only available for the binary
data attribute type. In addition, if you turn it on, you won't be able to query
Core Data using this attribute.
In sum, besides strings, integers, doubles, Booleans and dates, Core Data can also
save binary data, and it can do so efficiently and intelligently.
Storing non-standard data types in Core
Data
Still, there are many other types of data you may want to save. For example, what
would you do if you had to store an instance of UIColor ?
With the options presented so far, you would have to deconstruct the color into its
individual components and save them as integers (e.g., red: 255, green: 101, blue:
155). Then, after fetching these components, you'd have to reconstitute your color
at runtime.
Alternatively, you could serialize the UIColor instance to NSData and save it as
binary data. Then again, you'd also have to “add water” afterward to convert the
binary data back to the UIColor object you wanted in the first place.
 
Search WWH ::




Custom Search