WKWebView截图不完全呈现整页高度

我正在尝试在WKWebView中捕捉整个页面的截图。 会发生什么事情只是在视口中可见的东西得到渲染和图像的其余部分呈灰色。 它有正确的尺寸,只是没有从图像捕捉获取所有的数据。

我已经尝试了几种方法,这个似乎是最有前途的:

extension WKWebView { // only captures part of the screen func screenCapture(size: CGSize) -> UIImage { var image: UIImage? // sets the scrollView to the height of it's content self.scrollView.bounds = CGRectMake(0, 0, size.width, size.height) UIGraphicsBeginImageContextWithOptions(size, true, 1.0) self.scrollView.drawViewHierarchyInRect(self.scrollView.bounds, afterScreenUpdates: true) image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image! } } 

有没有人设法捕捉iOS8 +中的WKWebView的完整屏幕截图? 如果是这样,你的解决scheme是什么? 我在iOS9中遇到同样的问题。