Ionic ios 构建不使用位置

Ionic ios build not using location

所以我在 ionic2 中构建了一个应用程序来跟踪 phone 的当前位置。我在 android 中构建它并且在位置打开时工作正常但是当我在 iOS 中构建它时该应用程序不会显示在隐私>位置服务中并且不会跟踪 phone的当前位置。

const watchOptions = {
        enableHighAccurary: true,
        maximumAge:5000,
        timeout: 5000
    }
    if(state == 'login'){
        this.watch = this.geolocation.watchPosition(watchOptions).subscribe(pos => {
            if(pos.coords != undefined){
                console.log('tracking');
                this.firebaseApp.database().ref("LOCATION").child(this.user.$key).update({
                    lat: pos.coords.latitude,
                    lng: pos.coords.longitude,
                    timeStamp: moment().format('MMMM Do YYYY, hh:mm A').toString(),
                    fName: this.user.fName,
                    lName: this.user.lName,
                    status: 'login'
                });
            }
        }); 
    }
    else{
        this.watch.unsubscribe();
    }

您必须输入 NSLocationWhenInUseUsageDescription-key 和 NSLocationAlwaysAndWhenInUseUsageDescription-key 到 .plist-file。

您在 "platforms/ios"

中找到此文件