Ionic 1 on ios $http stop working after 1day usage of app

#1

Hi everybody, I have an Ionic app and it works great.

But.

I installed it on device(iphone 6) and it works properly first 10 or 15 hours, then it stopped to send requests and when I open it review with safari firebug I see that everything works except of requests. Maybe someone met this problem before? Or this known issue? Because after 2 or 3 hours of searching I didn’t find anything.

What I have - I send an location each 5 min to server in the background.

In .run I start process -


document.addEventListener('deviceready', function () {
        if (typeof cordova != 'undefined') {
            cordova.plugins.backgroundMode.enable();// is now available
            cordova.plugins.backgroundMode.on('activate', opticLocation.startLocation());
        }
    }, false);

and in my service I get location and send it t the server:

function startLocation() {
        if ( angular.isDefined(stop) ) return;
            stop = $interval(function() {
                var token = window.localStorage.getItem("userToken");
                if (typeof(token) != 'undefined' && token != null) {
                    sendLoc();
                }
          }, 1000*60*5);
    }

And here I get location:

function sendLoc () {
        console.log('strat');
        $cordovaGeolocation.getCurrentPosition(options).then(function(position) {
            console.log(position);
            getCountry(position).then(function(country) {
                console.log(country);
                getCity(position).then(function(city){
                    console.log(city);
                    apiSaveLocation = Path.getVar('apiSaveLocation');
                    $http.post(apiSaveLocation, {latitude: position.coords.latitude, longitude: position.coords.longitude, country: country.long_name, city: city.long_name}, {headers: {"X-CSRF-Token" : window.localStorage.getItem("userToken")}}).then(function(response) {
                        console.log('success');
                        $ionicLoading.hide();
                    }, function (error) {
                        console.log('error');
                        $ionicLoading.hide();
                    })
                }, function() {
                    $ionicLoading.hide();
                });
            })
        }, function(error) {
            $ionicLoading.hide();
        });
    }

And at beginning this what I have in my console -
[Log] strat (console-via-logger.js, line 173)
[Log] Position {coords: Coordinates, timestamp: 1500718282532.319} (console-via-logger.js, line 173)
[Log] {long_name: “Ukraine”, short_name: “UA”, types: [“country”, “political”]} (console-via-logger.js, line 173)
[Log] Success
And I can see that app made requests and get response, but after 10 or 15 hours here what I get in console:
[Log] strat (console-via-logger.js, line 173)
[Log] Position {coords: Coordinates, timestamp: 1500718282532.319} (console-via-logger.js, line 173)
[Log] {long_name: “Ukraine”, short_name: “UA”, types: [“country”, “political”]} (console-via-logger.js, line 173)
No any success or error
No any requests - http://prntscr.com/fyuist
No any errors in console.

Could anybody help?