ionic1 https服务无法在ios设备中运行

时间:2018-03-05 10:49:15

标签: angularjs iphone cordova http ionic-framework

我是混合移动领域的新人,现在我正在使用ionic1和angularjs1,所以现在我的服务调用来自控制器中的angularjs $ http服务。所以我的https网址在Android设备上工作。但不能在ios设备上工作。在android http响应成功功能上工作,但在ios设备中错误功能返回。

 $scope.doLogin = function(mobile) { 

          alert(mobile);
          $rootScope.user_devid; 

          var datas = { serviceinput: '{"Username":'+mobile+',"DeviceId":'+$rootScope.user_devid+',"PushnotificationId":"22","DeviceType":"1"}' };        
          $.ajax({
  url: "https://xxxxxxxxxxx/pgr/external/mobileservice?serviceId=getLogin",
  type: "POST",
  dataType: "html",
  headers: {
            "content-type": "application/x-www-form-urlencoded"
          },
        data: datas,
  success: function (data, status, jqXHR) {
    //$("#container").html(data);
    alert("Local success callback.");
    alert(JSON.stringify(data));
  },
  error: function (jqXHR, status, err) {
    alert("Local error callback.");
    alert(JSON.stringify(jqXHR));
    },
  complete: function (jqXHR, status) {
    alert("Local completion callback.");
        alert(JSON.stringify(jqXHR));
  }
})
}       

上面我的代码我正在使用jquery ajax。现在问题出现了,我没有。在ios设备中可以添加任何配置设置。

    <platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    <icon height="57" src="resources/ios/icon/icon.png" width="57" />
    <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
    <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
    <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
    <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
    <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
    <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
    <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
    <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
    <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
    <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
    <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
    <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
    <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
    <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
    <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
    <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
    <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
    <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
    <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
    <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
    <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
    <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
    <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
    <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
    <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
    <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
    <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
    <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
    <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
    <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
    <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform>

这是我在平台ios上的config.xml文件。

1 个答案:

答案 0 :(得分:0)

请尝试使用此标题

       headers: {
                'Content-Type': undefined
            }

       //replace application/x-www-form-urlencoded with undefined