wkwebview

How to load CSS file by using URL in WKWebView

依然范特西╮ 提交于 2020-06-17 12:55:25
问题 I want to inject CSS by using URL link , Working Working below code, If I store CSS file in Bundle path of project, lazy var webView: WKWebView = { guard let path = Bundle.main.path(forResource: "style", ofType: "css") else { return WKWebView() } let cssString = try! String(contentsOfFile: path).components(separatedBy: .newlines).joined() let source = """ var style = document.createElement('style'); style.innerHTML = '\(cssString)'; document.head.appendChild(style); """ let preferences =

From IOS 13.0 cookiesDidChange is never triggered when cookies change on webview

会有一股神秘感。 提交于 2020-06-15 05:47:06
问题 I am using Cookie Store Observer to to track changes in the cookies value on my webview. It was working fine on all versions of IOS. but since IOS 13.0 came out, this no longer works. I am not getting any call to @available(iOS 11.0, *) func cookiesDidChange(in cookieStore: WKHTTPCookieStore){ cookieStore.getAllCookies { cookies in //Store cookies to UserDefaults on Background Thread DispatchQueue.global(qos: .userInitiated).async { self.storeCookies(cookies: cookies) } } } I am setting

WKWebView - prevent automatic scrolling triggered by user text selection

点点圈 提交于 2020-06-13 22:55:36
问题 When a user performs a tap and hold gesture to select a word and then drags their finger towards either the top or bottom edges of the screen, the page automatically scrolls in order to accommodate the selection. here is a short clip demonstrating it I would like to prevent this behavior inside a WKWebView . Here is what I have tried so far: in a bridge.js file which is accessible to the webview: var shouldAllowScrolling = true; document.addEventListener('selectionchange', e => {

WKWebview allowsLinkPreview to false breaks text selection

十年热恋 提交于 2020-06-12 06:17:33
问题 We have an app that uses WKWebview, but sets allowsLinkPreview to false because we don't want link preview behavior. It seems that starting with iOS 13.4, on devices that don't have 3D touch functionality (older devices and newer iphone models), setting allowsLinkPreview to false also disables all text selection in the page! For our app, text selection is critically important. I came up with this theory reading between the lines in the documentation: In iOS this property is available on

WKWebview allowsLinkPreview to false breaks text selection

≡放荡痞女 提交于 2020-06-12 06:11:30
问题 We have an app that uses WKWebview, but sets allowsLinkPreview to false because we don't want link preview behavior. It seems that starting with iOS 13.4, on devices that don't have 3D touch functionality (older devices and newer iphone models), setting allowsLinkPreview to false also disables all text selection in the page! For our app, text selection is critically important. I came up with this theory reading between the lines in the documentation: In iOS this property is available on

WKWebview allowsLinkPreview to false breaks text selection

喜你入骨 提交于 2020-06-12 06:11:10
问题 We have an app that uses WKWebview, but sets allowsLinkPreview to false because we don't want link preview behavior. It seems that starting with iOS 13.4, on devices that don't have 3D touch functionality (older devices and newer iphone models), setting allowsLinkPreview to false also disables all text selection in the page! For our app, text selection is critically important. I came up with this theory reading between the lines in the documentation: In iOS this property is available on

Replaced UIWebView with WKWebView, but still same error from Apple

余生颓废 提交于 2020-06-01 07:38:26
问题 I have removed the UIWebView from my app. But when I uploaded the iOS app on iTunes I still got the same message "Re: ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs" I have searched for UIWebView globally in the project and there are no search results. That simply means UIWebView is removed. I have updated the pods too. I have verified the presence of UIWebView in the app archive using below code: grep -r "UIWebView" . The response is

Loading local file in WKWebView doesn't working in device

北战南征 提交于 2020-05-29 07:40:23
问题 I can't load local epub file (from document directory) in wkwebview. It's working in simulator but not in device. I learned that it's a bug for iOS 8 from here. Is it already solved for iOS 8 ? Please help me what should i do. I got error in device as - The operation couldn't be completed. (KCFErrorDomainCFNetwork error 1.) Here is code snippet - -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.webView removeObserver:self forKeyPath:@"loading"]; [self

How to set iOS WkWebview zoom scale

生来就可爱ヽ(ⅴ<●) 提交于 2020-05-29 07:35:25
问题 My iOS app has a WKWebView component which shows an full-screen WebApp (1280x800) with different aspect ratio and size then a iPad (4:3, 1024x768) I want to set the WkWebView zoom factor to 0.8, to fit it in landscape mode. How can I control the zoom scale of the WkWebView? I tried to set the the zoom scale of the WkWebView scrollview, but it doesn't scale for values below 1, even when I set the minimumZoomScale accordingly. [self.webView.scrollView setMinimumZoomScale:0.8]; [self.webView

How to find UIWebView in Project and replace it with WKWebView?

妖精的绣舞 提交于 2020-05-29 05:37:32
问题 We identified one or more issues with a recent delivery for your app, "App Name" 1.0 (5.0). Please correct the following issues, then upload again. ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview). Best regards, The App Store Team Getting above email from no_reply@email.apple.com while uploading build. I've not used