objective c renderInContext crash on background thread
I have an app in which the screen continuously is capturing in background thread. Here is the code - (UIImage *) captureScreen { UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; CGRect rect = [keyWindow bounds]; UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); [[keyWindow layer] renderInContext:context]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIDeviceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; if ((orientation ==