Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

404
Visualizações
Unhandled promise rejection: Error: One of the `NSLocation*UsageDescription` keys must be present in Info.plist to be able to use geolocation

I am trying to add background location tracking to my React-Native/Expo app (managed workflow SDK 42) but I keep getting an error, telling my I need to add a specific item to my Info.plist.

Below is my code for how I request for permissions in the app, as well as my Info.plist

//Code in my JS requesting background permissions

useEffect(()=> {

  let isActive = true;

  const requestBackgroundPermissions = async () =>{
    const {status} = await Location.requestBackgroundPermissionsAsync()
    if(status === 'granted'){
      await Location.startLocationUpdateAsync(LOCATION_TASK_NAME, {
        accuracy: Location.Accuracy.Balanced,
      });
    }
  }

  async function getBackgroundLocationAsync() {
   let { status } = await Location.requestBackgroundPermissionsAsync()
     if(status !=='granted'){
       setErrorMsg('Permission to access background location was denied')
         return;
     }
     let backgroundLocation = await Location.getBackgroundPositionAsync({});
         setBackgroundLocation(backgroundLocation);
   }

   getBackgroundLocationAsync()

   return() =>{
     isActive=false
   }

 },
[],
)

//TaskManager, I don't know if I'm doing this part right

TaskManager.defineTask(LOCATION_TASK_NAME,({data,error})=>{
    if(error){
      return;
    }
    if(data){
      const{locations} = data
    }
  })

//Info plist

"ios": {
      "supportsTablet": true,
      "infoPlist":{
        "NSLocationAlwaysAndWhenInUseUsageDescription":"Allows App to use location services in the foreground and background.",
        "NSFaceIDUsageDescription":"Allows App to use Face ID for a simpler sign in.",
        "UIBackgroundModes":[
          "location",
          "fetch"
        ],
      }
    },

//Android Permissions

"android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "permissions":[
        "ACCESS_COARSE_LOCATION",
        "ACCESS_BACKGROUND_LOCATION",
        "ACCESS_FINE_LOCATION",
      ],

    },
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda