1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Ionic 4 iOS app request to API throws error unknown, status 0

Discussão em 'Angular' iniciado por PostMans, Novembro 5, 2024 às 15:43.

  1. PostMans

    PostMans Guest

    I have a Ionic 4 with Angular app which connects to my API. On Android / Browser the calls to the API are working (no errors on the console). However on iOS I sometimes get an error:


    "status":0,"statusText": "Unknown Error"

    ERROR: {
    "headers":{"normalizedNames":{},
    "lazyUpdate":null,
    "headers":{}},
    "status":0,
    "statusText": "Unknown Error",
    "url":"https://api.domain.com/v2/profile",
    "ok":false,
    "name":"HttpErrorResponse",
    "message":"Http failure response for https://api.domain.com/v2/profile: 0 Unknown Error",
    "error":{"isTrusted":true}}


    The weird thing is, this is not happening all the time.

    Scenario:

    1. Angular httpClient GET call to https://api.domain.com/v2/profile => Works, getting data back
    2. Another GET call (navigation occurred) to https://api.domain.com/v2/list => Works
    3. Going back to previous page a new GET call to https://api.domain.com/v2/profile fails and throws above error.

    It doesn't matter how many times you navigate, it randomly throws the above error. If it had anything to do with CORS I assume it would throw the error every time you do a request on iOS.

    Ionic info

    Ionic:

    Ionic:

    Ionic CLI : 5.2.7 (/usr/local/lib/node_modules/ionic)
    Ionic Framework : @ionic/angular 4.8.1
    @angular-devkit/build-angular : 0.801.3
    @angular-devkit/schematics : 8.3.2
    @angular/cli : 8.3.2
    @ionic/angular-toolkit : 2.0.0

    Cordova:

    Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
    Cordova Platforms : ios 5.0.1
    Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 10 other plugins)

    Utility:

    cordova-res : 0.6.0
    native-run : 0.2.8

    System:

    ios-sim : 8.0.2
    NodeJS : v10.16.3 (/usr/local/bin/node)
    npm : 6.9.0
    OS : macOS Mojave
    Xcode : Xcode 10.2.1 Build version 10E1001


    Safari console screenshot:

    [​IMG]

    Continue reading...

Compartilhe esta Página