So my app freezes and won’t response to touch events. It doesn’t crash it just sits there?
If I push the pause button ||, it stops on the following line of code.
NSArray *results = [context executeFetchRequest:request error:&error];
If I then push play that app is still frozen and if I push pause again its still point to the above line of code.
Here is the full code where it pauses.
NSManagedObjectContext *context = [NSManagedObjectContext contextForCurrentThread];
NSEntityDescription *entity = [self entityDescriptionInContext:context];
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:[entity name]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(thingId like[c] %@)", sessionID];
[request setPredicate:predicate];
NSError *error = nil;
NSArray *results = [context executeFetchRequest:request error:&error]; **<-- Pause lands me here**
if (!results || error || 0 == results.count){
return nil;
}
return [results objectAtIndex:0];
Found the answer I moved away from using “LIKE [c]” and now using “==” instead. I also moved away from using [AppDelegate managedObjectContext] in my app when fetching anything and instead using contextForCurrentThread.
By doing both of these my app has stopped freezing.