How are you building/running your app?
Does this also happen on Android or ionic serve? @ionic/app-scripts : 1.3.8 is old and can be upgraded to 1.3.12.
Sujan12, yes of course I am building/running my app on Android. On Android 4,5 I have the same error, but with
cordova-plugin-crosswalk-webview it working well ! Maybe issue is that once I enter the Promise I am in a different context; the “this” no longer points to the “this” ?
Not that clear when the title only includes “ios” and also the list of platforms doesn’t list “android”.[quote=“anton_klochko, post:5, topic:95853”]
On Android 4,5 I have the same error, but with
cordova-plugin-crosswalk-webview it working well !
[/quote]
Couly you expand on that? WHen does it work on Android, when doesn’t it?
Please answer that question. I want to know the command you execute on the CLI.[quote=“anton_klochko, post:5, topic:95853”]
Maybe issue is that once I enter the Promise I am in a different context; the “this” no longer points to the “this” ?
[/quote]
Missing something for the Android command? cordova should be in there.
So it doesn’t work on iOS at all, on Android only for 6+7, not for 4+5. Correct?
Use identical commands to run/build - choose if you want to use --prod right now or not. Same for --livereload (I suggest to drop that). Then write again where it works and were it doesn’t.
Sujan12, this full error text,do not you know what this mean ?
Uncaught (in promise): TypeError: Cannot assign to read only property 'partDescription' of [object Object]↵TypeError: Cannot assign to read only property 'partDescription' of [object Object]↵
This is my function …
public get_parts(resourcePtr, model_id):Promise<any> {
return new Promise((resolve, reject)=> {
let output = [];
this.sql.query("SELECT * FROM model_" + model_id + "_boms as tb1 INNER JOIN model_" + model_id + "_parts as tb2 ON tb1.bomPartPtr =tb2.PartPtr WHERE tb1.resourcePtr=? ORDER BY tb1.bomReference", [resourcePtr]).then(data=> {
let localdesc = '';
for (let i = 0; i < data.res.rows.length; i++) {
if (data.res.rows.item(i).bomLocalDesc != null)
localdesc = data.res.rows.item(i).bomLocalDesc.replace(/\{ItemObject\.Description}/g, " ");
data.res.rows.item(i).partDescription = data.res.rows.item(i).partDescription + localdesc;
output.push(data.res.rows.item(i));
}
this.sql.query("SELECT * FROM model_" + model_id + "_boms as tb1 WHERE (tb1.resourcePtr=?) AND (tb1.bomPartPtr IS NULL) ORDER BY tb1.bomReference", [resourcePtr]).then(data_new=> {
for (let i = 0; i < data_new.res.rows.length; i++) {
if (data_new.res.rows.item(i).bomLocalDesc != null)
data_new.res.rows.item(i).partDescription = data_new.res.rows.item(i).bomLocalDesc.replace(/\{ItemObject\.Description}/g, " ");
else
data_new.res.rows.item(i).partDescription = '';
let obj = Object.assign({PartPtr: '', id: '', notes: '', partCode: ''}, data_new.res.rows.item(i));
output.push(obj);
}
Array.prototype.sort.call(output, function (a, b) {
a = parseInt(a['bomReference']);
b = parseInt(b['bomReference']);
if (isNaN(a) && !isNaN(b))
return 1;
else if (!isNaN(a) && isNaN(b))
return -1;
else if (!isNaN(a) && !isNaN(b))
return (a > b) ? 1 : (a < b) ? -1 : 0;
else
return -1;
});
resolve(output);
});
}).catch(err=> {
reject(err)
})
});
}
Sujan12, thanks a lot, I will try something. p.s Could you suggest please how to build for real device ? How to run app on real device ? I would like to test on real device to understand how it is work …
I have similar issue with VirtualScroll. Strange thing that VirtualScroll is not generating this error on other (modal) page. Problem not relative to iOS 10.3! Just VirtualScroll!
Code of page with error:
this.items = [];
this.fullItems = [];
if (res.items) { // typically array
let n: number = 0;
this.fullItems[n] = [];
this.fullItems[n]['items'] = [];
this.fullItems[n]['date'] = res.items[0]['date'];
this.fullItems[n]['items'].push(res.items[0]);
for (let i = 1; i < res.items.length; ++i) {
if (this.fullItems[n]['date'] != res.items[i]['date']) {
this.fullItems[++n] = [];
this.fullItems[n]['items'] = [];
}
this.fullItems[n]['date'] = res.items[i]['date'];
this.fullItems[n]['items'].push(res.items[i]);
}
this.items = this.fullItems.slice(); // tried after error with this.items = this.fullItems;
} else {
this.items = [];
}