Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

$http.get doesn't work when live-testing on iOS

$
0
0

@Grayda wrote:

My app works great on Android and in the browser, but on my iPhone 4s running iOS 9.2.1, my initial $http.get doesn't complete, nor does it throw an error.

I've read about needing to install the whitelist plugin, which I did. I also installed an npm package (https://www.npmjs.com/package/cordova-plugin-transport-security) which added the required lines into AppName-info.plist just fine, but no matter what I do, my $http.get simply won't run, even though the website in question is https.

Full disclosure: Tonight is the second time I've ever touched Xcode, my first time being about five years prior to fiddle with Objective-C

Here's the code in question that doesn't run:

.factory('aceFactory', ["$http", "$q", function($http, $q, $rootScope) {
  return {
    service: "https://api.example.com/v1/?type=all",
    loadData: function(lat, long) {
      var deferred = $q.defer()
      $http.get(this.service + "&source=app&lat=" + lat + "&long=" + long + "&tz=" + new Date().getTimezoneOffset(), {
        timeout: 15000
      }).then(function(data) {
        deferred.resolve(data.data)
      }, function(err) {
        alert(err.data.message)
      });
      return deferred.promise
    }
  }
}])

The code code doesn't even time out after 15 seconds, it just sits there with the spinner (that is shown before the $http.get call) and never progresses, even after half an hour of waiting.

Anyone come across this issue yet?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>