I'm trying to fixe an issue that I can see on my iDevice but not on my Mac (obviously).
I've marked a very high CPU activity on this line:
data = [NSData dataWithData:UIImageJPEGRepresentation(image, 1.0)];
This appears when I'm downloading and showing a HD picture (4-5Mo).
Is anything wrong in my code or am I doing something really bad ?
Finally this line was not that important. My problem was that I thought that my asynchronous method was in another thread. It wasn't.
I start thinking about new thread with:
[NSThread detachNewThreadSelector:@selector(test:) toTarget:self withObject:myObject];
For my problem, is it the best way to do it ?
There is a solution here very well explain for the problem of non-blocking thread using NSManagedObjectContext
with children.
For the other problem( high CPU activity) is was due to this non-blocking thread problem.