[ 
https://issues.apache.org/jira/browse/CB-11997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15706322#comment-15706322
 ] 

ASF GitHub Bot commented on CB-11997:
-------------------------------------

Github user shazron commented on a diff in the pull request:

    
https://github.com/apache/cordova-plugin-wkwebview-engine/pull/23#discussion_r90092299
  
    --- Diff: src/ios/CDVWKWebViewEngine.m ---
    @@ -123,6 +123,32 @@ - (void)pluginInitialize
                    name:UIApplicationWillEnterForegroundNotification 
object:nil];
     
         NSLog(@"Using WKWebView");
    +
    +    [self addURLObserver];
    +}
    +
    +- (void)onReset {
    +    [self addURLObserver];
    +}
    +
    +static void * KVOContext = &KVOContext;
    +
    +- (void)addURLObserver {
    +    if(![[NSProcessInfo processInfo] 
isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){.majorVersion = 9, 
.minorVersion = 0, .patchVersion = 0 }]){
    +        [self.webView addObserver:self forKeyPath:@"URL" options:0 
context:KVOContext];
    +    }
    +}
    +
    +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object 
change:(NSDictionary<NSString *,id> *)change context:(void *)context
    +{
    +    if (context == KVOContext) {
    +        if (object == [self webView] && [keyPath isEqualToString: @"URL"] 
&& [object valueForKeyPath:keyPath] == nil){
    +            NSLog(@"URL is nil. Reloading WebView");
    --- End diff --
    
    Change WebView to WKWebView to give more clarity in the log here.


> The webView should reload when a crash occurs (iOS 8)
> -----------------------------------------------------
>
>                 Key: CB-11997
>                 URL: https://issues.apache.org/jira/browse/CB-11997
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin WKWebViewEngine
>            Reporter: Connor Pearson
>            Assignee: Shazron Abdullah
>
> When the WKProcess dies, the content is blanked out and the URL becomes nil. 
> This results in a "white screen" that can only be resolved by restarting the 
> app. See this for more info: https://bugs.webkit.org/show_bug.cgi?id=148685
> With the iOS9 API, it is now possible to detect when the WKProcess dies. On 
> iOS 8, we can listen for changes on URL of the WKWebView to be notified when 
> it crashes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to