开发者

Store very small sound files with core data

I saw in other posts that it is O.K to store small image files (less then 50 kb) as a bin开发者_JS百科ary data inside core data. is it true for sound files that are less then 20 kb?

Thanks Shani


There's no difference between sound files, image files or any other binary data as far as Core Data is concerned. Under 20kB I would store in Core Data unless you have a good reason not to (such as caching as mentioned), but I would store them as a separate entity if you are not accessing them every time you access an object.

The general rule of thumb I've seen mentioned is <10kB store on the entity, >10kB but <100kB store in a separate entity and >100kB store in the file system.


I store data like this in the file system and I keep the path to the file in my core data object. This lets me optionally use a class that caches lookup of the images that can be emptied if the program receives memory warnings.

You should read the apple's "Core Data Performance" document, specifically the section on Large Data Objects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜