I am working on ionic 3 app. when i run it on browser its working fine but when i run as a apk or on mobile it gives me error ‘Unexpected token o in JSON at position 1’ as shown in screenshot https://prnt.sc/q0jxlf . i dont know why its occuring in apk while its working accurately on browser siple ionic serve run.this is my code
register(user)
{
return new Promise(resolve => {debugger;
this.http.post(global.apiUrl + "register", user.value)
// .map(res => res.json())
.subscribe(data => {debugger;
this.data = data;
resolve(this.data);
},error =>{debugger;
let jsonE = JSON.parse(error._body);
let alert = this.alertCtrl.create({
title: 'Error!',
subTitle:jsonE.error,
buttons: ['OK']
});
alert.present();
}
);
});
please help me i am musch confused