【问题标题】:Response with status:0 for URL:null when i am making a rest from ios ionic app当我从 ios ionic 应用程序休息时,响应状态为:0 的 URL:null
【发布时间】:2018-10-13 07:46:41
【问题描述】:

我正在从 ionic 应用程序打一个休息电话,它在 android 设备上工作,但在 ios 设备上不工作。 这就是我从我的 ionic 服务中拨打休息电话的方式。

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)
});

【问题讨论】:

  • 错误信息是什么?你能显示任何错误日志吗?
  • 响应状态:0 对于 URL:null
  • 如果出现 IO,您会在控制台中得到什么?
  • 我只是在弹出警报中收到上述错误。

标签: ios angular typescript ionic2 ionic3


【解决方案1】:

最后……我通过将 API URL 调用从“http://yourapiurl/”更改为“https://yourapiurl/”解决了这个问题,这听起来不错。请试试这个。

我从这里得到这个, Reference

谢谢。

【讨论】:

    猜你喜欢
    • 2018-08-16
    • 2023-03-11
    • 2017-01-24
    • 2018-06-11
    • 2017-11-08
    • 1970-01-01
    • 2017-07-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多