I tried out the code and can confirm it is correct but doesn't work on ion and below.
I read the docs for renderInContext:
and noticed it even tells you:
" WARNING: currently this method does not implement the full CoreAnimation composition model, use with caution."
I cross referenced the OSX docs and the are more explicit:
" Important
The OS X v10.5 implementation of this method does not support the entire Core Animation composition model. QCCompositionLayer, CAOpenGLLayer, and QTMovieLayer layers are not rendered. Additionally, layers that use 3D transforms are not rendered, nor are layers that specify backgroundFilters, filters, compositingFilter, or a mask values. Future versions of OS X may add support for rendering these layers and properties."
=> so thats why it works on ios7 but not ios6.
a workaround is to apply the mask not only to the layer but again to the ImageContext
//mask layer to image
UIGraphicsBeginImageContextWithOptions(_view1.bounds.size, NO, 0.0);
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0, _view1.bounds.size.height);
CGContextScaleCTM(UIGraphicsGetCurrentContext(), 1, -1);
[_view1.layer.mask renderInContext:UIGraphicsGetCurrentContext()];
UIImage * maskImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//draw img
UIGraphicsBeginImageContextWithOptions(_view1.bounds.size, NO, 0.0);
CGContextClipToMask(UIGraphicsGetCurrentContext(), _view1.bounds, maskImage .CGImage);
[_view1.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();