I have an app with a Storyboard scene. In the storyboard scene I have a UIWebView. In the storyboard scene I have a UIWebView. My code is as follows:
@IBOutlet weak var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: “http://www.somepage.com”)
let urlRquest = URLRequest(url: url!)
webView.loadRequest(urlRquest)
}
The user is able to navigate and click on links in the UIWebView. I run into an issue when that web view requests access to the camera or stored photos.
iOS presents a standard control at the bottom of the view with the following options: Take Photo or Video Photo Library Browse Cancel
Once the user selects ANY of the options the webview disappears and I get the following error:
<UIImagePickerController: 0x1071ae400> on <MyApp.WebViewVC: 0x10e924ae0> whose view is not in the window hierarchy!
- I am not able to use WKWebView in this particular app.
- I have verified that the proper permissions are requested in the plist file and I am able to access photo album and camera within the app and have requested permissions before calling the web view.
- I did not implement any of the UIImagePickerControllerDelegate functions as this is a UIWebView requesting access.