So I'm trying to troubleshoot this error on a client site, that only occurs on IOS 10 on mobile devices. They said it worked prior to upgrading their devices to IOS 10. Reverting back to IOS 9 actually doesn't produce this error. It appears to be something with JSON.parse along with it being localstorage data (this.local[i])). See below for js error, sample data, and javascript snippet.
Javascript Error:
[Error] SyntaxError: JSON Parse error: Unexpected identifier "function"
parse (Locus.js:40)
Data sample: (this.local)
[{"ObservationID":"444","Username":"blah","Deleted":0,"Flagged":0},
{"ObservationID":"555","Username":"blah","Deleted":0,"Flagged":0}]
Javascript:
Locus.prototype.loadFromLocal = function () {
if (this.local) {
for (var i in this.local) {
var len = ('' + this.local[i]).split('{').length;
if (len != 1) {
this.data[i] = JSON.parse(this.local[i]);
}
else {
if (parseFloat(this.local[i]) == this.local[i]) {
/* local storage is a number */
this.data[i] = parseFloat(this.local[i]);
}
else
{
/* already parsed */
this.data[i] = this.local[i];
}
}
}
}