// https://developer.apple.com/forums/thread/99674 // WKWebView and making sure cookies synchronize is really quirky // The main workaround I've found for ensuring that cookies synchronize // is to share the Process Pool between all WkWebView instances. // It also has to be shared at the point you call init static WKWebViewConfiguration CreateConfiguration() { var config = new WKWebViewConfiguration(); if (_sharedPool == null) { _sharedPool = config.ProcessPool; } else { config.ProcessPool = _sharedPool; } return(config); }
protected override void Dispose(bool disposing) { if (_disposed) { return; } _disposed = true; if (Interlocked.Decrement(ref _sharedPoolCount) == 0 && Forms.IsiOS12OrNewer) { _sharedPool = null; } if (disposing) { if (IsLoading) { StopLoading(); } Element.PropertyChanged -= HandlePropertyChanged; WebView.EvalRequested -= OnEvalRequested; WebView.EvaluateJavaScriptRequested -= OnEvaluateJavaScriptRequested; WebView.GoBackRequested -= OnGoBackRequested; WebView.GoForwardRequested -= OnGoForwardRequested; WebView.ReloadRequested -= OnReloadRequested; Element?.ClearValue(Platform.RendererProperty); SetElement(null); _events?.Dispose(); _tracker?.Dispose(); _packager?.Dispose(); _events = null; _tracker = null; _events = null; } base.Dispose(disposing); }
public static void Initialize() { var dt = DateTime.Now; _processPool = new WKProcessPool(); }