HTTP request error on iOS. Working fine other platforms

Hello guys -

I am receiving this error when using my freshly compiled app on a physical iOS device on XCode. I’ve had a good google about this, but all the other questions seem to pertain to this error on Android, but this is iOS.

App compiles fine and loads. But upon my login, the HTTP request that gets the JWT gets this error:

{“headers”:{“normalizedNames”:{},“lazyUpdate”:null,“headers”:{}},“status”:0,“statusText”:“Unknown Error”,“url”:"",“ok”:false,“name”:“HttpErrorResponse”,“message”:“Http failure response for : 0 Unknown Error”,“error”:{“isTrusted”:true}}

I’ve seen it speculated in other threads that this is a CORS error. Which I will say is unlikely, given the same request works everywhere else on a whole plethora of devices and formats. EDIT: Also the same error when using https://cors-anywhere.herokuapp.com/, so, I think we can rule this out.

Help much appreciated, thanks

Package.json:

{
  "name": "store-scanner",
  "version": "1.1",
  "author": "Adam P. Wright",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "release-build-android": "ionic cap build android --prod --release"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^12.2.4",
    "@angular/cdk": "^12.2.6",
    "@angular/cli": "^12.2.4",
    "@angular/common": "^12.2.4",
    "@angular/compiler": "^12.2.4",
    "@angular/core": "^12.2.4",
    "@angular/forms": "^12.2.4",
    "@angular/platform-browser": "^12.2.4",
    "@angular/platform-browser-dynamic": "^12.2.4",
    "@angular/router": "^12.2.4",
    "@capacitor-community/barcode-scanner": "^2.0.1",
    "@capacitor/android": "3.3.1",
    "@capacitor/app": "^1.0.3",
    "@capacitor/core": "^3.2.4",
    "@capacitor/haptics": "^1.0.3",
    "@capacitor/ios": "3.3.1",
    "@capacitor/keyboard": "^1.0.3",
    "@capacitor/push-notifications": "^1.0.6",
    "@capacitor/splash-screen": "^1.1.0",
    "@capacitor/status-bar": "^1.0.3",
    "@capacitor/storage": "^1.0.3",
    "@ionic/angular": "6",
    "@ionic/cli": "^6.17.1",
    "@ionic/storage-angular": "^3.0.6",
    "@swimlane/ngx-charts": "^19.0.1",
    "date-fns": "^2.24.0",
    "dateformat": "^5.0.1",
    "global": "^4.4.0",
    "install": "^0.13.0",
    "jetifier": "^2.0.0",
    "npm": "7.24.1",
    "rxjs": "~6.6.0",
    "tslib": "^2.3.1",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^12.2.4",
    "@angular-eslint/builder": "^12.2.4",
    "@angular-eslint/eslint-plugin": "^12.2.4",
    "@angular-eslint/eslint-plugin-template": "^12.2.4",
    "@angular-eslint/template-parser": "^12.2.4",
    "@angular/compiler": "^12.2.4",
    "@angular/compiler-cli": "^12.2.4",
    "@angular/language-service": "^12.2.4",
    "@capacitor/cli": "^3.2.4",
    "@ionic/angular-toolkit": "^4.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~3.8.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.2.4"
  },
  "description": "Vendor's Store Scanner for Wrightway Store"
}
1 Like

Anyone have an idea at all?

I am experiencing the exact same issue, The app runs perfectly and returns data from the API on browser & Android both on the simulator and a real device, however on IOS I get the response { isTrusted: true } on both the simulator and real device.

I have confirmed that is not an API issue or blocking of any sort, its just something that happens on IOS.

I have also done testing with third-party API’s that return data without an issue.

Have you maybe found a solution for your issue?

Thanks!

Yes I fixed it.

My solution is switching to the Capacitor HTTP client, if I remember correctly, I was using the Angular HTTP client before. It was a while ago though so I could be wrong. Try this! Hope it helps.