Post

Replies

Boosts

Views

Activity

Extract images loaded in a WKWebView
Related: https://developer.apple.com/forums/thread/47176 Hey all, I have a WKWebView running in the background of a SwiftUI app which loads webpages that have images in them: <img src="…" /> and would like to extract those image data from the WKWebView for using in my SwiftUI app. The app is supposed to run on iOS and macOS (sandboxed). I have a working solution of this, where I use WKWebView's evaluateJavaScript() to get the URL in the src attribute of the img-tag and then download that url in Swift to a Data object for further processing. While this solution works, it requires fetching the image a second time, which at best adds network load and at worst returns a different image. There is the option of re-rendering the img element to a canvas, extracting the ImageData from there using Javascript, and returning the blob to Swift. According to SO, rendering an img element to a canvas can disturb the image and this seems like an unstable workaround at best, so I have been looking for alternatives of directly getting the image from WKWebView. Are any of the following ideas feasible to extract image data from a WKWebView? Cache: Use WKWebsiteDataStore to fetch a WKWWebsiteDataRecord including the cached images (see here). Or could the image be showing on the WKWebView but not be saved in cache? Webarchive: Create a webarchive of the WKWebView (see here) and extract the image from there. Is there any documentation on parsing .webarchive files? Intercept network requests and responses: When using Safari web inspector's Network monitor, I can see all network requests and responses (including images). However, when using WKNavigationDelegate's method for intercepting WKNavigationActions (see here), I do not see image requests. Is there a way to see all network requests of a WKWebView including requests that load images into an img-element? Thank you! Cheers, Anton
0
2
1.3k
Oct ’22
Cannot connect App Store Connect to Slack for Xcode Cloud Notifications
I'm trying to connect my Developer Account in App Store Connect with Slack for CI notifications from Xcode Cloud. Apple docs for reference: https://developer.apple.com/documentation/xcode/connecting-xcode-cloud-to-slack#Install-the-Slack-app-for-Xcode- Cloud-using-App-Store-Connect I've tried connecting to the Slack workplace from the App Store Connect User settings and from Xcode Cloud in Xcode and on App Store Connect but no luck so far. The process always goes through and the Xcode Cloud Slack app gets installed on the Slack workspace. However it does not show up on the App Store Connect. I’ve attached a screenshot of the App Store Connect Notification Settings page after I went through the “Slack | Connect” flow successfully. It states “Your Slack account for has been connected”. However The Slack account still does not show as connected on the same page under "Send To”. Any help appreciated! Was anyone able to connect successfully?
2
0
997
Jul ’23