i am new on ios programming, when my app is running , i am taking these errors. I am loading 950+ images in my app and i am using ARC.
ImageIO: CGImag
As far as I can see your code looks fine, and running in the simulator (where plenty of memory) this should be working. A few suggestions:
1) use dataWithContentsOfFile:options:error:
instead of dataWithContentsOfFile:
, use the NSDataReadingUncached option (to reduce memory pressure on the system), and test the return value - if nil log the error and update your question.
2) You can always dump the data image in a NSCache object, and if the system needs memory it will release cache items, and you'll have to re-read the image from the file system. You can use this technique even if you only pull a few images at a time.
3) You can use UIImage imageWithContentsOfFile:
instead of getting the data then creating the image. In this case put the UIImage itself in the cache, with a key of its name.
From X-Code 10 Apple is not removing all NSCache instances dynamically as it done before. So as developer we need to Quit the simulator app and run the build your build be succeeded.