Group Group Group Group Group Group Group Group Group

Tutorial 3 - MyLocations. Fatal Error and Hud

(SP)
Que tal Matthijs,

Lo primero que me quiero comentarle es que su ejercicio es fantástico, es de esas cosas que generan adicción, lo tuve ahí olvidado por muchos meses y ahora que he decidido dedicarle tiempo, me tiene atrapado.
Tengo un par de dudas.
Lo primero es que nunca logre hacer que la app mandara un error y se cerrara de forma inesperada, por más que trate e incluso asigne el valor nulo de forma directa a una de las variables, no logro provocar el error.
Sin embargo, a pesar que la app no so se cierra de forma inesperada en ningún momento, si logro provocar que ejecute el código del listenForFatalCoreDataNotifications, veo la alerta por un segundo e inmediatamente se muestra el “Hud” y por consecuencia queda bloqueada la pantalla.
Preguntas:
¿De la fecha en que se publico el tutorial v.4.1 al día de hoy ha cambiado el manejo de el error fatal?
¿Por qué aun cuando en listenForFatalCoreDataNotifications mando a terminar la app muestra el “hud”?
¿Por qué la alerta no espera a que presione el botón Ok?

(EN)
Such Matthijs,
The first thing I want to tell me is that your exercise is fantastic, is one of those things that generate addiction, I had forgotten there for many months and now I have decided to dedicate time, I got caught.
I have a couple of questions.
The first is that it never succeeds in making the app send an error and close unexpectedly, even try and even assign the null value directly to one of the variables form, I can not cause the error.
However, although the app not so close unexpectedly at any time, if I can cause execute code listenForFatalCoreDataNotifications, I see the alert for a second and immediately the “Hud” is displayed and consequently the screen is locked .
Questions:
How the date was published the tutorial v.4.1 today has changed the handling of the fatal error?
Why even though listenForFatalCoreDataNotifications command to finish the app shows the “hud”?
Why the alert does not wait for press Ok?

Hi, this is a mistake in the book. The afterDelay() line needs to go inside the do { } block. So when there is a Core Data error, the screen does not automatically close.

(SP)
Gracias, eso quedo resuelto. En el mismo ejemplo MyLocations, en la función updateLocation de MapViewController manda el siguiente error: “Argument type ‘[Location]’ does not conform to expected type ‘MKAnnotation’” en la linea mapView.removeAnnotation(locations) y lo mismo en mapView.addAnnotation(locations), he revisado ejemplos de otros pero al parecer debería funcionar tal como esta. puede ayudarme con esto ?

Gracias.

(EN)
Thanks, that was solved. In the same example MyLocations in UpdateLocation of MapViewController function sends the following error: “Argument type ‘[Location]’ does not conform to expected type ‘MKAnnotation’” in line mapView.removeAnnotation (locations) and the same in mapView.addAnnotation (locations), have reviewed examples of other but apparently it should work as this. You can help me with this?

Thanks.

I think at this point you made Location into an MKAnnotation. However, the error message says [Location], not Location. The [] means that you’re trying to use an array of Location objects instead of a single Location object. Double-check your code to make sure you’ve written the correct thing. :wink:

Hi Matthijs

I’m seeing the same behaviour - the internal error alert is being presented briefly, but then it disappears of its own accord leaving the HUD screen presented and locked. The HUD isn’t being dismissed - the afterDelay is in the Do block. I’ve tried kicking off the dismiss of the HUD in advance of trying the save, but it makes little difference = the alert still disappears and I’m left at the previous view.

I’ll keep playing, but if you have any ideas…

BTW, v5 of the book, and working with Xcode 9 beta 6 in ‘swift 3 mode’.

Cheers
Darren

Forget it - user error :slight_smile:

Well this is good information i was searching for this information and thinking to make a new thread for this but i have no need to make thread after read out this information thanks for this have a nice day.

Cheers.