title: Swift: Getting 'Snapshotting a view that has not been rendered..' error when trying to open a URL in safari from my app
body: <p>One of the specifications of my app is that on tapping a tableView cell, the user will be redirected to the website associated with the cell. Here is the code: </p>
  
  <pre><code>override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
      if let url = NSURL(string: appdelegate.studentInfo[indexPath.row].url) {
          tableView.deselectRowAtIndexPath(indexPath, animated: true)
          UIApplication.sharedApplication().openURL(url)
      }
      else {
          let alert = UIAlertController(title: "Invalid URL", message: "Cannot open URL because it is invalid.", preferredStyle: UIAlertControllerStyle.Alert)
          alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Cancel, handler: nil))
          self.presentViewController(alert, animated: true, completion: nil)
      } 
  }
  </code></pre>
  
  <p>On my first tap, the URL opens like it is supposed to. However, returning to the app from Safari and touching another cell results in the following error, although the app still works like it is supposed to:</p>
  
  <blockquote>
    <p>Snapshotting a view that has not been rendered results in an empty
    snapshot. Ensure your view has been rendered at least once before
    snapshotting or snapshot after screen updates.</p>
  </blockquote>
  
  <p>Is there any way to avoid this error? Or is this a bug?</p>
  
  <p>I have experimented with dispatch_async blocks but it did not solve the problem.</p>