Within my application, I am dealing with objects that have a Map<number,any[]>
attribute. Currently, I am using localForage
for persistence. However, when the Map is saved and viewed on an Android or Windows device (browser simulation), it works fine but encounters issues on iOS and even fails to work on my Android device.
Here is some sample code illustrating the problem:
let myMap: Map < number, any[]& gt; = new Map();
myMap.set(1,['banana','pimento']);
console.log(myMap);
localForage.config({});
localForage.setItem("myMap",myMap)
.then(() => localForage.getItem("myMap")
.then(map => console.log(map))
);
The map displays correctly on Android and Windows (browser simulation) but not on iOS due to the use of a webSQL database instead of indexedDB which is used by the former platforms.
Should I serialize the data? Is there a more effective way to store the data that would resolve this issue?