title: how stringByEvaluatingJavaScript in AppDelegate
body: <h1>SOLVED</h1>
  
  <p>I used observer in ViewController</p>
  
  <p>I have a iOS webview in Swift3 and need call Js function from AppDelegate.
  The reason why is because i'm using push notifications, and when the user click on notification i need to pass the information from swift3 to JS.</p>
  
  <p>This is the head of my ZhWebViewController</p>
  
  <p><code>class ZhWebViewController: UIViewController, UIWebViewDelegate {
      func passNotificationToWebView(userInfo: AnyObject){
         let jsonData = try! JSONSerialization.data(withJSONObject: userInfo, 
         options:<br>
         JSONSerialization.WritingOptions.prettyPrinted)
         let jsonString = NSString(data: jsonData, encoding:<br>
         String.Encoding.utf8.rawValue)! as String
         self.webView.stringByEvaluatingJavaScript(from: 
         "triggerNotificationClick(\ 
         (jsonString))")
     }
  }</code></p>
  
  <p>This is how i declare my UIWebView</p>
  
  <p><code>@IBOutlet weak var webView: UIWebView!</code></p>
  
  <p>This is how i call JS functions, this way works!!!</p>
  
  <p><code>self.webView.stringByEvaluatingJavaScript(from: "someFunctionJS(\(jsonString))")</code></p>
  
  <p>This is head of my AppDelegate</p>
  
  <p><code>@UIApplicationMain
  class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow? 
  }</code></p>
  
  <p><strong>This is where i receive notification and here i want to call JS function</strong>, i try call a function in ZHWebView and there try to send to JS, but i get fatal error.</p>
  
  <p><code>@available(iOS 10, *)
  extension AppDelegate : UNUserNotificationCenterDelegate{
     func userNotificationCenter(_ center: UNUserNotificationCenter,
        didReceive response: UNNotificationResponse,
        withCompletionHandler completionHandler: @escaping () -&gt; Void) {
        let userInfo = response.notification.request.content.userInfo
        ZhWebViewController().passNotificationToWebView(userInfo: userInfo as 
        AnyObject)
        completionHandler()
     }
  }</code></p>