Tuesday, 13 August 2013

iOS: Can't start cordova inAppBrowser -> "Warning: Attempt to present on while a presentation is in progress"

iOS: Can't start cordova inAppBrowser -> "Warning: Attempt to present on
while a presentation is in progress"

I really need some help, because I'm very new to iOS-Developing and all
topics on my Xcode-warning I could find were about Objective-C.
As my app is mainly written with Cordova (Phonegap) these solutions aren't
really helpful.
So, what is there to tell:
I have a simple start screen, where you can start a barcode-scanner. The
result (which in the end is always an url) should be displayed in the
inAppBrowser of cordova.
If I call the window.open() with "_self" it works, but then it is very
difficult to get back to the startscreen, as far as I found out. So I
wanted to call the url with the inAppBrowser so there is a "Done" button,
but Xcode screams:
"Warning: Attempt to present on while a presentation is in progress!"
Here the JavaScript code where I'm calling the window.open() function...
app.initialize();
function demoScan() {
try {
var scanned = scan();
} catch (e) {
alert('scan failed');
}
}
function scan() {
var scanner = window.cordova.require("cordova/plugin/BarcodeScanner");
scanner.scan( function (result) {
var ref = window.open(encodeURI(result.text),'_blank','location=yes');
},
function (error) {
("Scanning failed: " + error);
});
}
In the end, I only need a (simple) solution, to get back to the start page
"index.html" when I'm on the Webpage the Barcode scanner is calling. If it
is through the inAppBrowser or with a self-coded "back" button in the
WebView, I really don't care.
Thanks in advance! :)

No comments:

Post a Comment