{"id":5875,"date":"2014-04-07T23:40:34","date_gmt":"2014-04-07T23:40:34","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/07\/terminating-app-due-to-uncaught-exception-nsinvalidargumentexception-reason-application-tried-to-present-a-nil-modal-view-controller-on-target-collection-of-common-programming-errors\/"},"modified":"2014-04-07T23:40:34","modified_gmt":"2014-04-07T23:40:34","slug":"terminating-app-due-to-uncaught-exception-nsinvalidargumentexception-reason-application-tried-to-present-a-nil-modal-view-controller-on-target-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/07\/terminating-app-due-to-uncaught-exception-nsinvalidargumentexception-reason-application-tried-to-present-a-nil-modal-view-controller-on-target-collection-of-common-programming-errors\/","title":{"rendered":"Terminating app due to uncaught exception &#39;NSInvalidArgumentException&#39;, reason: &#39;Application tried to present a nil modal view controller on target-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m new in iphone, I&#8217;m trying to open a view when pressing a button, in my class &#8220;ReaderViewController&#8221; I wrote the following code:<\/p>\n<pre><code>- (void)tappedInToolbar:(ReaderMainToolbar *)toolbar emailButton:(UIButton *)button\n{\n#ifdef DEBUGX\nNSLog(@\"%s\", __FUNCTION__);\n#endif\n\n#if (READER_ENABLE_MAIL == TRUE) \/\/ Option\n\ninstantiateViewControllerWithIdentifier:@\"searchView\"];\n\nif (printInteraction != nil) [printInteraction dismissAnimated:NO]; \/\/ Dismiss\n\nSearchViewController *searchController = [self.storyboard instantiateViewControllerWithIdentifier:@\"searchView\"];\n\n\nsearchController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;\nsearchController.modalPresentationStyle = UIModalPresentationFullScreen;\n\n[self presentModalViewController:searchController animated:YES];\n\n\n[searchController release];\n\n\n#endif \/\/ end of READER_ENABLE_MAIL Option\n}\n<\/code><\/pre>\n<p>I want when to open the view of this controller &#8220;SearchViewController&#8221; and in storyboard I gave the view of SearchViewController its identifier name &#8220;searchView&#8221; but when I run, it gives me the following Exception:<\/p>\n<pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:    'Application tried to present a nil modal view controller on target .'\n<\/code><\/pre>\n<p>Any Help ?? Thanks in advanced.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m new in iphone, I&#8217;m trying to open a view when pressing a button, in my class &#8220;ReaderViewController&#8221; I wrote the following code: &#8211; (void)tappedInToolbar:(ReaderMainToolbar *)toolbar emailButton:(UIButton *)button { #ifdef DEBUGX NSLog(@&#8221;%s&#8221;, __FUNCTION__); #endif #if (READER_ENABLE_MAIL == TRUE) \/\/ Option instantiateViewControllerWithIdentifier:@&#8221;searchView&#8221;]; if (printInteraction != nil) [printInteraction dismissAnimated:NO]; \/\/ Dismiss SearchViewController *searchController = [self.storyboard instantiateViewControllerWithIdentifier:@&#8221;searchView&#8221;]; searchController.modalTransitionStyle [&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-5875","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5875","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=5875"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5875\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}