iOS 11 takeSnapshot method on WKWebView not usable
Originator: | Josh.Lieberman92 | ||
Number: | rdar://33812691 | Date Originated: | August 9 2017 |
Status: | Open | Resolved: | |
Product: | iOS + SDK | Product Version: | Xcode 9 beta 5 |
Classification: | Serios Bug | Reproducible: | Always |
Area: WebKit Summary: Because the header WKSnapshotConfiguration.h is not public, the method takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?, completionHandler: @escaping (UIImage?, Error?) -> Swift.Void) is not visible on an instance of WKWebView. Steps to Reproduce: Try to use takeSnapshot(with snapshotConfiguration: WKSnapshotConfiguration?, completionHandler: @escaping (UIImage?, Error?) -> Swift.Void) in a Swift project. Observe the method is not visible to the compiler. Expected Results: The method should be usable in the latest Xcode 9 beta. Observed Results: The method is not usable in the latest Xcode 9 beta. Version: Xcode 9 beta 5 Notes: Configuration:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
I opened a similar radar (35094298) which was duped to this # as well.
I did find a workaround for the issue, which I have detailed here: https://stackoverflow.com/questions/46842384/wkwebkit-takesnapshotwith-snapshotconfiguration-not-working-on-ios-device
Workaround
Add
#import <WebKit/WKSnapshotConfiguration.h>
to your bridging header.https://stackoverflow.com/q/45600451/2415822