I am working for a hybrid mobile app using cordova 6.0.0.
According to my requirements , I have to open dynamic url in web view. The url would be provided by api response.
I am using the cordova in app browser plugin for web view.
https://github.com/apache/cordova-plugin-inappbrowser
Now when user clicks on any link in the page opened in the web view , I have to catch that click event and find the href value of the anchor tag on which user had clicked.
And if target url will match my condition , i have to open camera without closing the web view , so that i can maintain the state of web view even after picture was taken successfully.
For camera functionality i am using cordova default camera plugin.
I have done this successfully in Android.
But in case of IOS i am not able to open camera. As i have checked the control is going inside the camera plugin , but it is giving below warning
Warning: Attempt to present <CDVCameraPicker: 0x1570d1800> on <MainViewController: 0x1565624a0> whose view is not in the window hierarchy!
I have checked many posts regarding this and some peoples have suggested to use Iframe instead of web view. But i am not able to catch the click event in dynamically loaded Iframe.
Can someone please help what should be the solution for this , is there any way i can do this as per my requirements.
Thanks in advance
I recently had the same problem and managed to solve it. You have to open the InaAppBrowser as a subview to show the camera on top of it. All modifications take place in the CDVInAppBrowser.m if the InAppBrowser plugin.
You have to modify the show method of CDVInAppBrowser:
Just remove the commented line and add the 2 following the commented line. In the close method of CDVInAppBrowser you have to add:
right before
[self.inAppBrowserViewController close];
.Done, the camera now opens on top of the inappbrowser and passes the image to it.
p.s.: remember to remove and add the ios platform in order to apply the changes