I am having trouble with my Windows 10 cordova application.
I am trying to use the navigator.notification.confirm but it keeps throwing me this error
Exception calling native with command :: Notification :: confirm ::exception=WinRTError: The parameter is incorrect
I am running this command on another page and it is running fine. I don't know why it is working on one page and not another.
This is the code for my index page - WORKS FINE
navigator.notification.confirm( 'This will download new data, do you want to confirm?', 'callback', 'Are you sure?', ['Refresh', 'Cancel'] )
However, the code below doesn't work at all and I don't know why at all
navigator.notification.confirm( 'Please select an option', ImageCaptureInput.currentInstance.onConfirm2, 'Photo / video', ['Photo','Cancel','Video'] );
I have this working on WP8, Android and iOS and it works fine. Windows 10 throws this unknown error. Having a Google around and a quick look on here didn't help at all.
Any help would be greatly appreciated.
EDIT:
I get these errors in the debug console in Visual Studio. It seems the error is only with the confirm function of the navigator.notification plugin.
0x800a139e - JavaScript runtime error: InvalidAccessError Exception was thrown at line 221, column 13 in ms-appx-web://cordova.platform.windowsUWP/www/plugins/cordova-plugin-dialogs/src/windows/NotificationProxy.js 0x80070057 - JavaScript runtime error: The parameter is incorrect. Exception was thrown at line 240, column 13 in ms-appx-web://cordova.platform.windowsUWP/www/plugins/cordova-plugin-dialogs/src/windows/NotificationProxy.js
2ND EDIT
The error seems to be occurring when it gets to the showAsync() part of the function, shown below
confirm:function(win, loseX, args) { if (isAlertShowing) { var later = function () { module.exports.confirm(win, loseX, args); }; alertStack.push(later); return; } isAlertShowing = true; try { var message = args[0]; var _title = args[1]; var buttons = args[2]; var md = new Windows.UI.Popups.MessageDialog(message, _title); buttons.forEach(function(buttonLabel) { md.commands.append(new Windows.UI.Popups.UICommand(buttonLabel)); }); md.showAsync().then(function(res) { isAlertShowing = false; var result = res ? buttons.indexOf(res.label) + 1 : 0; if (win) { win(result); } if (alertStack.length) { setTimeout(alertStack.shift(), 0); } }); } catch (e) { // set isAlertShowing flag back to false in case of exception isAlertShowing = false; if (alertStack.length) { setTimeout(alertStack.shift(), 0); } // rethrow exception throw e; } },
0 comments:
Post a Comment