I use unleash segue to relax to the initial view controller in my storyboard. Rollback works fine, I implemented this method in my first view controller:
- (IBAction) unwindToInitialViewController:(UIStoryboardSegue *) unwindSegue { }
However, if I try to execute segue on another view controller after I do this, I get the following error:
Warning: an attempt to present whose gaze is not in the Hierarchy window!
This only seems to happen if I disconnect from the view controller, which is checked as the "Initial View Controller" in the storyboard. This is mistake? Should I be able to relax to this initial controller? Other ideas?
EDIT:
This is how I perform the second session:
[self performSegueWithIdentifier:@"mySegue" sender:nil];
I should note that this is a login / logout problem. When I log in for the first time, segue will work from my controller login controller. When I log out, I unwind the source controller. Then I log in again and the session from my controller login controller does not work.
EDIT 2:
From more research, I found it because I use a delegate for my entry. The login isync, I make a call with AFNetworking, and when this is done, I call my login delegate (in this case, VC to log in). At this point, the login login can go to the view.
Login Code:
- (void) login: (NSDictionary *) parameters { [http.manager POST:url parameters:parameters success:^(AFHTTPRequestOperation *operation, NSDictionary *response) { [self.loginDelegate loginSuccess:response]; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { [self.loginDelegate loginFailure:error]; }]; }
My VC login, which is the delegate:
- (void) loginSuccess:(NSDictionary *) response {
I checked that I am in the main stream, when I cross and still have no luck. I know that AFNetworking always causes success / failure blocks in the main thread.
The hard part. If I changed this code above to use a block rather than a delegate, then the / segue storyboard wasn’t messed up, and I can log in and log out without problems.
Why is segue working for the first time with a delegate template, but when I log out (unwind), I may not use this session again?
EDIT 3:
Further research shows that when unwinding, my VC viewDidAppear login is called twice. Upon initial shutdown, the view still remains on the stack, indicating that it is displayed quickly, and viewDidAppear is called. However, it quickly animates, and viewWillAppear is called a second time with another VC. I think this may be causing the problem. Why, when I deploy this VC, is it animated just to be animated again?