title: preference not working ios watch
body: <p>I have developing an ios watch app. I want to pass a value to ios watch. i have try several methods. When storing value in a element of ios app. I am using xcode 8 and the code is written in swift.</p>
  
  <p><strong>ViewController.swift</strong></p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      @IBOutlet weak var webview: UIWebView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          print("webview")
          let url = URL (string: "http://www.google.com/")
          let request = URLRequest(url: url!)
          webview.loadRequest(request)
  
          let preferences = UserDefaults.standard
          let currentLevel = "cl"
          let currentLevelKey = "currentLevel"
          preferences.set(currentLevel, forKey: currentLevelKey)
          preferences.synchronize()
          print("pref")
      }
  
  }
  </code></pre>
  
  <p>Then i have call the preference in ios watch app the code is
  <strong>InterfaceController.swift</strong></p>
  
  <pre><code>class InterfaceController: WKInterfaceController {
  
      @IBAction func clickingTheButton() {
          print("clicked")
          let preferences = UserDefaults.standard
          let currentLevelKey = "currentLevel"
  
          if preferences.object(forKey: currentLevelKey) == nil {
              // Doesn't exist
              print("Doesn't exist")
          } else {
              let currentLevel = preferences.integer(forKey: currentLevelKey)
              print("preference : ",currentLevel)
          }
      }
  
  }
  </code></pre>
  
  <p>How to pass value from ios to watch app. Please help me.</p>