{"id":4397,"date":"2014-03-30T10:30:50","date_gmt":"2014-03-30T10:30:50","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/presentmodalviewcontrolleranimated-gives-white-screen-collection-of-common-programming-errors\/"},"modified":"2014-03-30T10:30:50","modified_gmt":"2014-03-30T10:30:50","slug":"presentmodalviewcontrolleranimated-gives-white-screen-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/presentmodalviewcontrolleranimated-gives-white-screen-collection-of-common-programming-errors\/","title":{"rendered":"presentModalViewControllerAnimated: gives white screen-Collection of common programming errors"},"content":{"rendered":"<p>Hey all. Something which has been bugging me quite a bit recently is this custom movie player I&#8217;ve put together. It&#8217;s largely based on a working one, <code>NGMoviePlayer<\/code>.<\/p>\n<p>The issue is this: I have the <code>.xib<\/code> in a UIKit-friendly resource bundle. When I call:<\/p>\n<pre><code>[MyMoviePlayerViewController initWithNibName:@\"MyMoviePlayerViewController\"\n bundle:[NSBundle bundleWithPath:\n         [[NSBundle mainBundle] bundlePath]\n          stringByAppendingPathComponent:@\"MyMoviePlayerViewController.bundle\"]];\n<\/code><\/pre>\n<p>..on my custom class, and then access the <code>view<\/code> (thus calling <code>loadView<\/code>) it doesn&#8217;t throw any errors, but nor does it actually load the outlets properly. I am presented with a white screen, and debugging shows that all visual elements are <code>0x0<\/code>, but there was no error as would be expected.<\/p>\n<p><strong>EDIT:<\/strong> I&#8217;ve also now tried just loading the .xib outside of a resource bundle in my target app, and the same thing happens (white screen).<\/p>\n<p>The particular ones I was looking for was either:<\/p>\n<ul>\n<li><code>Could not load NIB ...<\/code> if it wasn&#8217;t found at all, or<\/li>\n<li><code>...loaded the NIB but the view outlet was not set<\/code> if it was found but not connected properly<\/li>\n<\/ul>\n<p>The xib is in the local app (I understand that static libs can&#8217;t contain xibs). I&#8217;ve tried using this same resource bundle with the <code>NGMoviePlayerDemo<\/code> project provided by the author of <code>NGMoviePlayer<\/code>, and it <em>does<\/em> throw an error:<\/p>\n<pre><code>Could not load NIB in bundle:\n'\/Users\/...\/MyMoviePlayerViewController.bundle (not yet loaded)'\n with name 'MyMoviePlayerViewController'\n<\/code><\/pre>\n<p>I have navigated to the path it displays for the bundle and there exists a <code>MyMoviePlayerViewController.xib<\/code> file at that location.<\/p>\n<p>I&#8217;ve also tried using <code>bundle:nil<\/code> in case Xcode combined the resources of bundle directories with the main one for some reason. Both cases throw no error and display a white screen in my actual project. Both cases throw a <code>Could not load NIB<\/code> error in the <code>NGMoviePlayerDemo<\/code> project.<\/p>\n<p><strong>EDIT:<\/strong> I have tried the same .xib separate from a resource bundle in the <code>NGMoviePlayerDemo<\/code> app and it works fine.<\/p>\n<p>All input is greatly appreciated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey all. Something which has been bugging me quite a bit recently is this custom movie player I&#8217;ve put together. It&#8217;s largely based on a working one, NGMoviePlayer. The issue is this: I have the .xib in a UIKit-friendly resource bundle. When I call: [MyMoviePlayerViewController initWithNibName:@&#8221;MyMoviePlayerViewController&#8221; bundle:[NSBundle bundleWithPath: [[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@&#8221;MyMoviePlayerViewController.bundle&#8221;]]; ..on my custom [&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-4397","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4397","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=4397"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4397\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}