IOS app got error and crashed when use geolocation plugin


#1

here is my controller code.i want to make a GPS app.so i did like this with google maps.please help me if you know the reason.thank you

var posOptions = {timeout: 10000, enableHighAccuracy: false};
$cordovaGeolocation
.getCurrentPosition(posOptions)
.then(function (position) {
$scope.watchCount = $scope.watchCount + 1;
console.log($scope.watchCount);
var lat = position.coords.latitude;
var long = position.coords.longitude;
$scope.lat_geo = position.coords.latitude;
$scope.long_geo = position.coords.longitude;
var userLatLngInit = new google.maps.LatLng(lat,long);
$scope.currentLoc = userLatLngInit;
initialize(userLatLngInit);

        }, function(err) {
            // error
            alert(err);
            console.log("error getCurrentPosition");
            console.log(err);
            $ionicLoading.hide();
            $scope.GoBack();

        });

    var watch = $cordovaGeolocation.watchPosition({ frequency: 2000,timeout : 3000, enableHighAccuracy: false });
    watch.then(function() { /* Not  used */ },
        function(err) {
            // An error occurred.
            alert(err);
            console.log("error watch then");
            console.log(err);
            $ionicLoading.hide();
            $scope.GoBack();
        },
        function(position) {
            // Active updates of the position here
            // position.coords.[ latitude / longitude]
            // this is where you will add your code to track changes in co-ordinates
            $scope.watchCount = $scope.watchCount + 1;
            console.log($scope.watchCount);
            var lat  = position.coords.latitude;
            var long = position.coords.longitude;
            $scope.lat_geo = position.coords.latitude;
            $scope.long_geo = position.coords.longitude;

            var userLatLng = new google.maps.LatLng(lat,long);
            $scope.currentLoc = userLatLng;
            updateUserLocation(userLatLng);


        });

here is xcode console when runing on the app