SMSidat
SMSidat

Reputation: 1183

Crash when trying to open a viewcontroller via storyboard reference

I've got a segue that opens a viewcontroller via a storyboard reference in the viewDidLoad of the parent controller. Everything worked in the earlier versions of iOS and Xcode, however it seems to give me a crash now with the message

[Assert] Assuming bar button item's view exists.

I'm not sure what to do - I've tracked the crash down to the line which references the segue that opens the referenced viewcontroller.

I've set the anchor as the bar button item.

[self performSegueWithIdentifier:@"menuPopSegue" sender:nil];

Upvotes: 0

Views: 221

Answers (2)

SMSidat
SMSidat

Reputation: 1183

I moved my code into the viewDidAppear method instead of the viewDidLoad (where it originally was). It now works and presents the viewController in a popOver - I assume the problem was because in the viewDidLoad items were initialised but not actually presented yet on screen and the new UIPopoverPresentationController class requires the anchor and its properties to be fully loaded.

Upvotes: 0

Munzareen Atique
Munzareen Atique

Reputation: 480

Make sure you have set the identifier in storyboard which you are calling here.

Upvotes: 1

Related Questions