Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
async/await con el bloque Try and Catch

Estoy obteniendo la ubicación de un usuario de Expo. Si bien el bloque catch siempre se ejecuta primero, la ubicación posterior aún se obtiene correctamente. Sin embargo, la captura debería ocurrir solo si no se obtuvo la ubicación.

PD: Ocurre solo cuando estoy probando la aplicación en un dispositivo real bajo una conexión de túnel. Sin embargo, funciona bien en el emulador. Sin embargo, no veo nada malo con el Código.

Por favor comenta.

 useEffect(() => { const verifyPermissions = async () => { const result = await Permissions.askAsync(Permissions.LOCATION); if (result.status !== 'granted') { Alert.alert( 'Insufficient permissions!', 'You need to grant location permissions to use this app.', [{ text: 'Okay' }] ); return false; } return true; }; (async () => { const hasPermission = await verifyPermissions(); if (!hasPermission) { return; } try { const location = await Location.getCurrentPositionAsync({}); setPickedLocation({ latitude: location.coords.latitude, longitude: location.coords.longitude, }); } catch (err) { Alert.alert('Could not fetch location!', 'Please try again.', [ { text: 'Okay' }, ]); } })(); }, []);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!