{"id":1826,"date":"2022-08-30T15:19:46","date_gmt":"2022-08-30T15:19:46","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/nsgenericexception-reason-push-segues-can-only-be-used-when-the-source-controller-is-managed-by-an-instance-of-uinavigationcontroller-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:46","modified_gmt":"2022-08-30T15:19:46","slug":"nsgenericexception-reason-push-segues-can-only-be-used-when-the-source-controller-is-managed-by-an-instance-of-uinavigationcontroller-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/nsgenericexception-reason-push-segues-can-only-be-used-when-the-source-controller-is-managed-by-an-instance-of-uinavigationcontroller-collection-of-common-programming-errors\/","title":{"rendered":"NSGenericException&#39;, reason: &#39;Push segues can only be used when the source controller is managed by an instance of UINavigationController-Collection of common programming errors"},"content":{"rendered":"<p>so I&#8217;m making an app with 5 view controllers, the first is embedded in a UINavigationController and the segue between the first 4 view controllers works fine. However introducing a 5th View Controller has broken this, and I&#8217;m getting the error<\/p>\n<pre><code>Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'\n<\/code><\/pre>\n<p>I havent done anything differently with this 5th view controller, its just a standard ViewController with an image view and a label, and all of my segues are called by ctrl dragging buttons in the storyboard. Does anybody have any idea whats causing this?<\/p>\n<p>Thanks<\/p>\n<ol>\n<li>\n<p><strong>add Navigation Controller to your initial view<\/strong><\/p>\n<ol>\n<li>Select the initial view<\/li>\n<li>Go To <strong>Editor<\/strong>&#8211;&gt; <strong>Embed In<\/strong> &#8211;&gt; <strong>Navigation Controller.<\/strong><\/li>\n<\/ol>\n<\/li>\n<li>\n<p>Set UINavigationcontroller as Initial View controller (Initial Scene) in StoryBoard.<\/p>\n<\/li>\n<li>\n<p>This is most likely because your push segue from the button or whatever is pointing to a view controller not the navigation view controller your view controller inherits. So, you have to point the segue to the navigation controller.<\/p>\n<p>Hope this helps.<\/p>\n<\/li>\n<li>\n<p>Try use a modal instead of a push segue.<\/p>\n<\/li>\n<li>\n<p>You just need to embed a Navigation Controller into your Source View Controller ( The one initial view, not the view you are pushing for ) . This can be done by selecting the Source View Controller and Go To Editor&#8211;&gt; Embed In &#8211;&gt; Navigation Controller.<\/p>\n<p>If you think that the Navigation Bar that the Navigation Controller has done . Simply select the Navigation Controller , In the &#8220;Show the Attributes Inspector&#8221; disable the Shows Navigation Bar.<\/p>\n<\/li>\n<li>\n<p>If your application has navigation controller as root view controller of window ,select storyboard file and then select the corresponding navigation controller , in Simulated Metrics select Is Initial View Controller checkbox. This worked for me. Hope this helps.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-12-02 06:14:21. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>so I&#8217;m making an app with 5 view controllers, the first is embedded in a UINavigationController and the segue between the first 4 view controllers works fine. However introducing a 5th View Controller has broken this, and I&#8217;m getting the error Terminating app due to uncaught exception &#8216;NSGenericException&#8217;, reason: &#8216;Push segues can only be used [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1826","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1826"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1826\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}