From 6cb6c2014aa713220633f45d9e023934b6aefb1b Mon Sep 17 00:00:00 2001 From: Emil Marashliev Date: Mon, 29 Sep 2014 15:24:14 +0300 Subject: [PATCH] Check if Javascript function handleOpenURL() exist. --- bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m b/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m index cc8226035e..1cf7fb6f2d 100644 --- a/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m +++ b/bin/templates/project/__PROJECT_NAME__/Classes/AppDelegate.m @@ -100,7 +100,7 @@ - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplic } // calls into javascript global function 'handleOpenURL' - NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", url]; + NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}", url]; [self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString]; // all plugins will get the notification, and their handlers will be called