IONIC ios 模拟器无法发出 http 请求

IONIC ios emulator not able to make http requests

在 ios 模拟器上 post 请求 ionic 5 时遇到问题

如果我在 android 模拟器上发出请求,它工作正常,但是当我在 IOS 模拟器上发出请求时,我收到此错误消息

[console.log]: "POST call in error" {
   "headers": {
    "normalizedNames": {},
     "lazyUpdate": null,
     "headers": {}
   },
   "status": 0,
  "statusText": "Unknown Error",
  "url": " <my url>.json",
  "ok": false,
  "name": "HttpErrorResponse",
   "message": "Http failure response for  <my url>/access_token.json: 0 Unknown Error",
   "error": {
     "isTrusted": true
   }
 }

这就是我提出请求的方式,在 angular

中使用 http-client
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';

感谢任何帮助!

您的 iOS 项目的服务器或 ATS 配置似乎有问题。要验证这一点,您可以尝试在 Xcode 项目的 Info.plist 文件中打开“允许任意加载”。

将此值设置为 "YES" 并检查它是否有效。

您可能在“Info.plist”文件中找不到此密钥。在这种情况下,您将必须添加此键设置。

所以事实证明我试图访问的端点有一个过期的 SSL,这是不可能的 IOS。设法修复 ssl,现在我的应用程序可以在 IOS 上运行,希望这对其他人有帮助