API calling not work in IOS build


#1

In my ionic project i used private api to get flight details. it successfully work in android build. When i create IOS build it didn’t show anything from the api. how can i solve this issue?


get_arrivalflights() {

    var communicationParams = {
      showLoader: true,
      reqUrl: "",
      reqBody: {},
      callBackSuccess: (response) => {
        console.log(response);
        this.objectData = response.flightStatuses;
      
      },
      callBackFailure: (response) => { console.log("failure dude"); console.log(response); }
    };
    this.restservice.makeGetRequest(communicationParams);
  }
makeGetRequest(communicationParams: any) {
    
  this.baseUrl = "  the url i want to call ";


    var loader;
    if (communicationParams.showLoader == true) {
      loader = this.loadingController.create({
        content: ""
      });
      loader.present();
    }
    this.http.get(this.baseUrl + communicationParams.reqUrl)
      .map(response => response.json())
      .subscribe(communicationParams.callBackSuccess, function(respone) {
          if (communicationParams.showLoader == true) {
            loader.dismiss()
          }
          communicationParams.callBackFailure(respone);
        },
        () => {
          console.log('Authentication Complete');
          if (communicationParams.showLoader == true) {
            loader.dismiss()
          }
        });
  }

#2

What is your ionic info output?
How are you building and testing the app?
What protocol does the API endpoint use?


#3

ionic info:


cli packages: (/usr/local/lib/node_modules)
    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2
global packages:
    Cordova CLI : 7.0.1 
local packages:
    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : ios 4.5.2
    Ionic Framework    : ionic-angular 3.7.1

System:
    Node  : v6.11.2
    npm   : 3.10.10 
    OS    : macOS Sierra
    Xcode : Xcode 8.3.3 Build version 8E3004b

building and testing of the app working perfectly.
API data displayed correctly in ionic serve and android build APK . but not in ios build file(in simulator)


#4

Please don’t answer to similar questions, but to exactly those. What exact commands are you using? We need these answers to know what is going on.


#5

cordova build ios


#6

Am finding the same issue the application is working perfectly when I hit the api in ionic serve and Android build.
If I build the same in iOS its not working


#7

I am also facing same issue.