In my drawing app I'm using UIImage to cache drawing on it.
The following line of code cause a memory issue:
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0.0);
self.cacheImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
How can I use UIGraphicsGetImageFromCurrentImageContext
without causing memory leaks ?
Any help will be appreciated. Thanks in advance.
Use this may be it help you. It help me in my case
@autoreleasepool {
// Write your code here
}