React Native iOS
*As you can see my code that the location popup permission is not showing in iOS, while I am using "react-native-geolocatio-service". I am struggling with, please help me, it would be more appreciable.**
onPressLocation = () => {
var that = this;
async function requestLocationPermission() {
const options = {
maxWidth: 500,
maxHeight: 500,
storageOptions: {
skipBackup: true,
},
};
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
{
title: 'ThoughtBulb App location Permission',
message: 'ThoughtBulb App needs access to your location ',
},
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
Geolocation.getCurrentPosition(
position => {
const currentLongitude = JSON.stringify(position.coords.longitude);
const currentLatitude = JSON.stringify(position.coords.latitude);
that.setState({
currentLatitude: currentLatitude,
currentLongitude: currentLongitude,
});
},
error => {
console.log(error);
},
{enableHighAccuracy: true, timeout: 15000, maximumAge: 10000},
);
} else {
alert('Location Permission is denied.');
}
}
if (Platform.OS === 'android') {
requestLocationPermission();
} else {
*****Here I need to get iOS location permission popup before execute below funtion.
I think this issue raised after updated the Xcode from 10 to 12***
Geolocation.getCurrentPosition(
position => {
const currentLongitude = JSON.stringify(position.coords.longitude);
const currentLatitude = JSON.stringify(position.coords.latitude);
that.setState({
currentLatitude: currentLatitude,
currentLongitude: currentLongitude,
});
},
error => {
console.log(error);
},
{enableHighAccuracy: true, timeout: 15000, maximumAge: 10000},
);
}
};
React Native iOS *As you can see my code that the location popup permission is not showing in iOS, while I am using "react-native-geolocatio-service". I am struggling with, please help me, it would be more appreciable.**
I think this issue raised after updated the Xcode from 10 to 12*** Geolocation.getCurrentPosition( position => { const currentLongitude = JSON.stringify(position.coords.longitude); const currentLatitude = JSON.stringify(position.coords.latitude); that.setState({ currentLatitude: currentLatitude, currentLongitude: currentLongitude, }); }, error => { console.log(error); }, {enableHighAccuracy: true, timeout: 15000, maximumAge: 10000}, ); } };