I’m using this code in my app in a few different places:
$scope.savedArray = JSON.parse(success);
I’m using this to parse an object that looks like this (but this is from the android device):
[{"name":"Coke","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1470946604752.jpg"},{"name":"Water bottle","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1470947814112.jpg"},{"name":"Floor","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1471008757165.jpg"},{"name":"Napkin","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1471017826729.jpg"},{"name":"Mints","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1471019378144.jpg"},{"name":"Pen","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1471020047007.jpg","added":1471020062149},{"name":"Keys","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1471020222752.jpg","added":1471020226031},{"name":"J key","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1471020489587.jpg","added":1471020498741},{"name":"Iphone","imgSrc":"file:\/\/\/storage\/emulated\/0\/Android\/data\/com.ionicframework.imageapp683613\/cache\/1471030455485.jpg","added":"1471030462181"}]
My app is working fine on Android devices, but gives me this error on iOS devices:
Error: JSON Parse error: Unexpected EOF parse@[native code]
Does anyone have any ideas about what this is about? It seems like the iOS device doesn’t want to parse the data in the same way or something.
- Thanks