Hi, i’m using WKWebView (on IOS), which shows WebGL content, and try to save screenshot from it. But after capturing, the snapshot has not a 3D content.
For capturing i used classic method:
UIGraphicsBeginImageContextWithOptions(_webView.bounds.size, YES, 0);
[_webView drawViewHierarchyInRect:_webView.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();In IOS 11 beta, WKWebView has a new API -
- (void)takeSnapshotWithConfiguration:(nullable WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(UIImage * _Nullable snapshotImage, NSError * _Nullable error))completionHandler API_AVAILABLE(ios(11.0));but it returns the same result.
If I understand correctly, WKWebView uses separated some WK processes for rendering and CARender Server for collecting all render datas and pushes its to OpenGL/Metal pipeline. According to this scheme, I got the expected result. But all the same, how do i get snapshot ?
There is a possibility -takeSnapshotWithConfiguration: … will return image with full data in Release IOS11 , or in the next releases ?
Thanks.