Just a guess: I make an attribute and make it’s type “binary”. But in the end, how would I use that? I guess there is an NSData behind the scenes? So that attribute actually takes an NSData?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This question has been asked a number of times and the answer is a bit more complex.
When it comes to binary data you should determine how to store it based on the expected size of data you are going to be working with. The rule is:
In addition, when you are storing images, it is recommended to store them in a standard format such as JPG or PNG. By using the transformable property type you can actually have your subclass give the appearance of accessing the
UIImageclass when the actual store is a PNG representation. I go into this in detail in the bog post on Cocoa Is My Girlfriend.Update
The reason behind storing > 1M binary data on disk is because of the cache. The
NSPersistentStoreCoordinatorwill keep a cache of data so that when your app asks for the “next” object it doesn’t need to go back out to disk. This cache works really well. However it is small, very small on iOS. If you pull in a big piece of binary data you can easily blow out that entire cache and your entire app suffers greatly.