Top Banner
Proyectos de desarrollo para dispositivos móviles Networking iOS GUI Button TextView ImageView
5

Networking - Tec · 2019-11-04 · View Controller Scene View Controller Safe Area Networking Stack View HTML Texto B Imagen B JSON Stack View Tv Texto Image View Act Espera HTML

Apr 19, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Networking - Tec · 2019-11-04 · View Controller Scene View Controller Safe Area Networking Stack View HTML Texto B Imagen B JSON Stack View Tv Texto Image View Act Espera HTML

Proyectos de desarrollo para dispositivos móviles

NetworkingiOS

GUI

Button

TextView

ImageView

Page 2: Networking - Tec · 2019-11-04 · View Controller Scene View Controller Safe Area Networking Stack View HTML Texto B Imagen B JSON Stack View Tv Texto Image View Act Espera HTML

Descargando datos de la red

❖ Para descargar datos (HTML) usamos un objeto de tipo URLSessionDataTask. Éste descarga los datos en segundo plano sin bloquear la interfaz de usuario.

Prueba

❖ Prueba el código con las siguientes direcciones:

➡ https://www.google.com

➡ https://www.googlex.com

➡ https://www.netflix.com

➡ https://www.netflix.itesm.mx

¿Cómo detectamos el error cuando no existe el servidor?

Page 3: Networking - Tec · 2019-11-04 · View Controller Scene View Controller Safe Area Networking Stack View HTML Texto B Imagen B JSON Stack View Tv Texto Image View Act Espera HTML

Detectando errores

Errores en el recurso

¿Qué sucede si el servidor existe, pero no el recurso?

https://www.google.com/NoExiste

¿Y si no hay red?

Page 4: Networking - Tec · 2019-11-04 · View Controller Scene View Controller Safe Area Networking Stack View HTML Texto B Imagen B JSON Stack View Tv Texto Image View Act Espera HTML

Descargando datos

Vamos a descargar archivos "grandes".

➡ http://norvig.com/big.txt

➡ https://www.ajegroup.com/wp-content/uploads/2014/05/BIG.jpg

Solo el thread principal puede modificar la GUI

➡ https://www.ajegroup.com/wp-content/uploads/2014/05/BIG.jpg

Descarga imagen

Page 5: Networking - Tec · 2019-11-04 · View Controller Scene View Controller Safe Area Networking Stack View HTML Texto B Imagen B JSON Stack View Tv Texto Image View Act Espera HTML

Descargando JSON

Vamos a descargar y procesar JSON

➡ https://api.tronalddump.io/search/quote?query=obama

Frameworks

❖ Alamofire

❖ BothamNetworking