我正在通过ionic应用程序拨打电话,其在android设备中工作,但在ios设备中工作。这就是我通过离子服务拨打电话的方式。
import { Http } from '@angular/http';
import { Injectable } from '@angular/core';
@Injectable()
export class loginService {
constructor(private http : Http){ }
getAllUsers(authData){
console.log(authData);
return this.http.post('http://Some IP add:8080/api/customerr/getUser', authData);
}
}
这是我在login.ts文件中接收数据的方式
this.loginservice.getAllUsers(this.loginForm.value).subscribe((response) => {
this.loginResponse = response.json()
} (err)=>{
alert(err)
});
最后……我通过将API URL调用从“ http://yourapiurl/”更改为“ https://yourapiurl/”解决了这个问题,这听起来不错。请尝试这个。
我从这里得到的,Reference
谢谢。