fix takeScreenshot crash

This commit is contained in:
Po-Jui Chen 2022-03-16 11:15:33 +08:00 committed by GitHub
parent f06bcdf695
commit 47ef668273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -670,17 +670,17 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
switch with["compressFormat"] as! String {
case "JPEG":
let quality = Float(with["quality"] as! Int) / 100
imageData = screenshot.jpegData(compressionQuality: CGFloat(quality))!
imageData = screenshot.jpegData(compressionQuality: CGFloat(quality))
break
case "PNG":
imageData = screenshot.pngData()!
imageData = screenshot.pngData()
break
default:
imageData = screenshot.pngData()!
imageData = screenshot.pngData()
}
}
else {
imageData = screenshot.pngData()!
imageData = screenshot.pngData()
}
}
completionHandler(imageData)