title: iOS 8 SDK: modal UIWebView and camera/image picker
body: <p>I have found that, when compiling for iOS 8 (and running in iOS 8), a <code>UIWebView</code> cannot show the camera/image picker if the <code>UIWebView</code> is in a view controller presented modally. It works without problem in view controllers directly “hanging” from the window <code>rootViewController</code> or view controllers pushed from it.</p>
  
  <p>The test application can be found at <a href="https://dl.dropboxusercontent.com/u/6214425/TestModalWebCamera.zip">https://dl.dropboxusercontent.com/u/6214425/TestModalWebCamera.zip</a> but I will describe it below.</p>
  
  <p>My test application (built with storyboards, but the real application doesn’t use them) has two view controllers (unoriginally named <code>ViewController</code> and <code>ViewController2</code>). <code>ViewController</code> is contained in a <code>UINavigationController</code> which is the root view controller. <code>ViewController</code> contains a <code>UIWebView</code> (works OK), a button that “shows” (“pushes”) <code>ViewController2</code>, and a <code>UIBarButtonItem</code> which modally presents <code>ViewController2</code>. <code>ViewController2</code> has another <code>UIWebView</code> which works when “pushed” but not when “presented”.</p>
  
  <p>Both <code>ViewController</code> and <code>ViewController2</code> are loaded with:</p>
  
  <pre><code>- (void)viewDidLoad {
    [super viewDidLoad];
  
    [self.webView loadHTMLString:@"&lt;input type=\"file\" accept=\"image/*;capture=camera\"&gt;" baseURL:nil];
  }
  </code></pre>
  
  <p>When trying to use the modal <code>UIWebView</code> Xcode prints the following in the console and dismisses the app modal:</p>
  
  <pre><code>Warning: Attempt to present &lt;UIImagePickerController: 0x150ab800&gt; on &lt;ViewController2: 0x14623580&gt; whose view is not in the window hierarchy!
  </code></pre>
  
  <p>My current theory is that the changes in <code>UIActionSheet</code> to <code>UIAlertController</code> might have produced this situation, but it’s quite hard to prove. I will open a Radar with Apple, just in case.</p>
  
  <p>Has someone found the same situation and some workaround?</p>