title: Inter-app communication in iOS using URL scheme
body: <p>I have two test apps: App1 &amp; App2.</p>
  
  <p>App1 takes String from the text field and triggers method:</p>
  
  <pre><code>@IBAction func openApp(sender: AnyObject) { 
      let url1 = ("app2://com.application.started?displayText="+textToSend.text!)
      let url2 = url1.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())
      UIApplication.sharedApplication().openURL(NSURL(string: url2!)!)
  }
  </code></pre>
  
  <p>Which actually opens App2 which has only label which should change to the text sent through the url, code is within AppDelegate.swift:</p>
  
  <pre><code>func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -&gt; Bool {
      let url = url.standardizedURL
      let query = url?.query
      ViewController().labelToDisplayResult.text = query
      return true;
  }
  </code></pre>
  
  <p>Unfortunately the line where I am trying to pass result of the URL to the actual label is giving me this error:</p>
  
  <pre><code>EXC_BAD_INSTRUCTION (CODE=EXC_I386_INVOP SUBCODE=0x0)
  </code></pre>
  
  <p>However I have all the data in the App2 for sure as I can see their values in debugger:</p>
  
  <pre><code>url NSURL   "app2://com.application.started?displayText=564315712437124375" 0x00007fa4e3426320
  query   String? "displayText=564315712437124375"
  </code></pre>
  
  <p>Any idea why I am getting this error?</p>
  
  <p>Thanks...</p>