-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
When we call callProjectApi() from ionic application to execute a command from Alan scripts, the callback doesn't get executed when running on Android or iOS device (or simulator). It does work when running in browser (ionic serve).
For example we call Alan's function greetUser
from ionic:
this.alanButtonRef.componentOnReady().then(async () => {
try {
if (!await this.alanButtonRef.isActive()) {
console.log('Calling: ' + 'await this.alanButtonRef.activate();');
await this.alanButtonRef.activate();
}
console.log('Calling: ' + 'this.alanButtonRef.callProjectApi(\'greetUser\', {}, ...');
this.alanButtonRef.callProjectApi('greetUser', {}, (error, result) => {
console.log(error, 'error');
console.log(result, 'result');
});
} catch (e) {
console.log('EXCEPTION in sendGreeting()');
console.log(e);
}
});
The callback function doesn't get called and those console logs don't ever get printed. Neither is there any caught exception. When testing on Android device we didn't see anything in the logs that would indicate what's the problem. But when running on iOS there is a log entry that could point to the problem:
To Native Cordova -> alanVoice isActive alanVoice1282791712 ["options": []]
⚡️ [log] - Calling: await this.alanButtonRef.activate();
To Native Cordova -> alanVoice activate alanVoice1282791713 ["options": []]
⚡️ [log] - Calling: this.alanButtonRef.callProjectApi('greetUser', {}, ...
To Native Cordova -> alanVoice callProjectApi alanVoice1282791714 ["options": [greetUser, {
}]]
⚡️ [log] - Error in Success callbackId: alanVoice1282791714 : TypeError: second argument to Function.prototype.apply must be an Array-like object (evaluating 'callback.apply(this, ...arguments)')
⚡️ [error] - {}
⚡️ ------ STARTUP JS ERROR ------
⚡️ TypeError: second argument to Function.prototype.apply must be an Array-like object (evaluating 'callback.apply(this, ...arguments)')
⚡️ URL: capacitor://localhost/polyfills-es2015.js
⚡️ polyfills-es2015.js:3737:36
⚡️ See above for help with debugging blank-screen issues
Metadata
Metadata
Assignees
Labels
No labels