title: Swift 3 Attempt to present whose view is not in the window hierarchy
body: <p>This question has been asked many times but even after trying most of the possible things I am still unable to find a solution that works for me. 
  Here is the error message.</p>
  
  <blockquote>
    <p>Warning: Attempt to present  on &lt;0x7f8f29e17590> whose view is not in the window hierarchy!</p>
  </blockquote>
  
  <p>Note: I am not using any navigation controller.</p>
  
  <p><strong>I am just presenting a view controller modally</strong> and I have a button on it for linkedIn sign up. But every time I click the linkedin button this error appears and I am unable to see the new linkedIn dialog although it works fine in other classes.</p>
  
  <p>Most solutions recommend handling button click in viewDidAppear already tried that and it doesn't work.</p>
  
  <p>I am using this code for opening linkedIn signup form</p>
  
  <pre><code>linkedinHelper.authorizeSuccess({ [unowned self] (lsToken) -&gt; Void in
  
          print("success lsToken: \(lsToken)")
          self.requestProfile()
          }, error: { [unowned self] (error) -&gt; Void in
  
              print("Encounter error: \(error.localizedDescription)")
          }, cancel: { [unowned self] () -&gt; Void in
  
              print("User Cancelled!")
      })
  </code></pre>