• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

116
Vistas
Error downloading openstreetmap tile on react-native

I'm making a react-native application and I need to allow to use the map without internet. For this I download the tiles on the mobile with react-native-fs. I don't understand the following error:

[Error: Unable to resolve host "tile.openstreetmap.org": No address associated with hostname]

On postman I have to put a Host field in the header but in the doc I don't have this field indicated : https://operations.osmfoundation.org/policies/tiles/

postman request

request:

    RNFS.downloadFile({
      fromUrl: link,
      toFile:
        dir +
        '/' +
        splitLink[splitLink.length - 3] +
        '/' +
        splitLink[splitLink.length - 2] +
        '/' +
        splitLink[splitLink.length - 1],
      headers: {
        'User-Agent': 'android',
      },
    })
      .promise.then(response => {
        console.log('response', response);
        if (response.statusCode === 200) {
          return console.log('FILES UPLOADED!', response);
        } else {
          console.log('SERVER ERROR');
        }
      })
      .catch(err => {
        console.log('err', err);
      });

I think it's the Host field that's missing in my request but I can't find what value to put.

Thanks for your help :)

almost 3 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda