0

I already checked out a few answers, but I have a different code that I have not seen here with this problem:

Warning: Attempt to present on whose view is not in the window hierarchy!

The problem encounters when I switched from VC1 to VC2. This is my code I used:

func ToVC2() {
    dispatch_async(dispatch_get_main_queue()) {
        [unowned self] in
        self.performSegueWithIdentifier("GoToVC2", sender: self)
    }
}

Then I have some logic in the prepareforsegue, but I don't think thats the problem here, or is it? If so I will post the code swell. Any help here is welcome!

Nahaku
  • 63
  • 7
  • What is your question? What do you exactly want to ask? – Ishmeet Jul 08 '16 at 22:10
  • How I remove the warning message by changing the code. I am obviously doing something wrong with this message popping up every second in my debug session. – Nahaku Jul 08 '16 at 23:06
  • Why are you using dispatch_async? Are you calling this function inside a closure? Is there any other code you're executing after segue? – Ishmeet Jul 08 '16 at 23:15
  • I got it from the answer of http://stackoverflow.com/questions/32292600/swift-performseguewithidentifier-not-working , the function stand on its own, and I am just executing some easy code after the segue, I don't think that is the problem. – Nahaku Jul 09 '16 at 11:48
  • Can you share your code? I don't see any reason yet why you see that warning. – Ishmeet Jul 09 '16 at 21:09
  • from what part is **toVC2 method** being executed? – Wilson Sep 05 '16 at 13:28

0 Answers0