Description
I'm having TypeError: seen.indexOf is not a function in an CordovaApp running on iOS 9.3. (The error does not happen on Chrome/Safari or iOS 10)
=> Please let me know if the work-around below does not cause any side effect. Thanks all.
I have following Parse Object structures:
- User : 1 entry
- House { owner: Pointer }: 3 entries with owner pointed the only User.
Then following code would throw the error:
var query = Parse.Query("House");
query.find().then(function(houses) {
JSON.stringify(houses); // This would throw the following error with provided stack
})
TypeError: seen.indexOf is not a function. (In 'seen.indexOf(seenEntry)', 'seen.indexOf' is undefined)
encode — parse.js:11238
default — parse.js:11190
value — parse.js:4286
stringify
Work-around: I added a check to make sure seen is an array.
key: 'toJSON',
value: function (seen) {
var seenEntry = this.id ? this.className + ':' + this.id : this;
var seen = Array.isArray(seen)? seen: [seenEntry];
var json = {};
var attrs = this.attributes;