Glimpse icon indicating copy to clipboard operation
Glimpse copied to clipboard

Terminated due to memory issue

Open lawgimenez opened this issue 5 years ago • 1 comments

Whenever I call stop() method, the app crashes with the debugger message: Terminated due to memory issue

lawgimenez avatar Oct 22 '18 09:10 lawgimenez

try the change code

- (UIImage *)imageFromView:(UIView *)view
{
    UIGraphicsBeginImageContextWithOptions(view.frame.size , YES , 0 );
    
//    if ([view respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
//        [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
//    } else {
        [view.layer renderInContext:UIGraphicsGetCurrentContext()];
//    }
    
    UIImage *rasterizedView = UIGraphicsGetImageFromCurrentImageContext();
    //compress image
    NSData* data = UIImageJPEGRepresentation(rasterizedView, 0.5);
    rasterizedView = [UIImage imageWithData:data];
    UIGraphicsEndImageContext();
    
    return rasterizedView;
}

shutup avatar Dec 28 '18 02:12 shutup