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

Shazron Abdullah commented on CB-2159:
--------------------------------------

Easy patch would be this in AppDelegate.m, but not ideal since it hard-codes 
500ms delay. Best to queue it up after webViewDidFinishLoad:

{code}
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url
{
    if (!url) {
        return NO;
    }
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 500 * NSEC_PER_MSEC), 
dispatch_get_current_queue(), ^{

        // calls into javascript global function 'handleOpenURL'
        NSString* jsString = [NSString 
stringWithFormat:@"handleOpenURL(\"%@\");", url];
        [self.viewController.webView 
stringByEvaluatingJavaScriptFromString:jsString];
        
        // all plugins will get the notification, and their handlers will be 
called
        [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
    });

    return YES;
}
{code}
                
> handleOpenURL not called on iOS
> -------------------------------
>
>                 Key: CB-2159
>                 URL: https://issues.apache.org/jira/browse/CB-2159
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>            Reporter: Shazron Abdullah
>            Assignee: Shazron Abdullah
>             Fix For: 2.4.0
>
>
> Idan Gozlan from the ML:
> Ive noticed that handleOpenURL function not called when app is closed and 
> launched by the custom url.
> the function works alright when the app is in background.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to