Background Location has not been configured

Warning prompt:

[Unhandled promise rejection: Error: Background Location has not been configured. To enable it, add location to UIBackgroundModes in Info.plist file.]

I have configured the app.json:

"ios": {
  "supportsTablet": true,
  "infoPlist": {
    "UIBackgroundModes": [
      "location",
      "fetch"
    ]
  }
}

Expo CLI 3.11.9 environment info:
System:
OS: macOS High Sierra 10.13.6
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.12.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5977832
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
expo: ~36.0.0 => 36.0.2
react: ~16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4
npmGlobalPackages:
expo-cli: 3.11.9

import React from ‘react’;
import { StyleSheet, Text, View,TouchableOpacity } from ‘react-native’;

import * as TaskManager from ‘expo-task-manager’;
import * as Location from ‘expo-location’;

const LOCATION_TASK_NAME = ‘background-location-task’;

TaskManager.defineTask(LOCATION_TASK_NAME, ({ data, error }) => {
if (error) {
// Error occurred - check error.message for more details.
return;
}
if (data) {
const { locations } = data;
console.log(“locations”,locations);
// do something with the locations captured in the background
}
});
export default class App extends React.Component {

componentDidMount = async()=>{
const { status } = await Location.requestPermissionsAsync();

await Location.startLocationUpdatesAsync(LOCATION_TASK_NAME, {
  accuracy: Location.Accuracy.Balanced,
});

}

render() {
return (
Enable background location
);
}
}

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.