I encounter this problem for the first time. I checked similar problems on stack overflow, but none of the solutions can solve my issue so I have this posting.
Up to the present, I have two view controllers
(let's say A and B) and I am trying to connect them with a segue with name "toB". When I run the program, Xcode told me Receiver(B) has no segue with identifier "toB"
.
I am pretty sure that the spellings of the identifier
in the storyboard
and in the code are exactly the same. And the line of the segue has connected the A view controller
and B view controller
.
But the storyboard
IDs of the two view controllers
are different. Is it the problem??
Hope someone could help me out. Thanks in advance!
SOLUTION
Thanks for @Amit Shelgaonkar's hint! In my case, moving the performSegueWithIdentifier
to viewDidAppear
still doesn't work, but moving it to applicationWillEnterForeground
solves the problem!
I still don't know why it doesn't work in my case, because when I tried to develop a testing app and put the performSegueWithIdentifier
in viewDidAppear
, it works perfectly.
you call performSegueWithIdentifier:sender:
in the viewDidLoad
. You can not dismiss a UIViewController
that isn't presented yet. viewDidLoad
has purely memory management functions, you can use it as (part of a) constructor. What may work, is to start a segue
in viewDidAppear
, however I would suggest to start with the view you want at the first time.