App crashes when I set map coordinates

I’m trying to update my WDC app to include some features @catsarisky suggested, and I’m not able to change the maps Latitude and Longitude whenever a variable changes. Other blocks inside the same event work perfectly. But when I add these blocks

, my app crashes.
Here’s what my variables look like:

Is this a bug or a problem in my code?

2 Likes

You’re pretty sure that city number has a numerical value? And that it matches the range of values in Itenerary? Might be worth writing some stuff to labels to see if there are any surprises. :slight_smile:

3 Likes

In my case it helped to do an explicit conversion to type “number”. You can do this by adding “0” to latitude and longitude. This seems to do nothing, but internally it converts the light blue block to numbers. If you feed something like “12.4” to “set map1 latitude” as a string, the app crashes, but doing some simple math "0 + “12.4"” does the trick.

2 Likes

I’ve tried that, but it doesn’t help. I’ll check again. Thanks for the suggestion!

Thanks, I’ll do that too!

1 Like

So, first have a look whats inside “in list ‘app variable latitudes’ get # …” by setting it to a label, and if it look like a number (by the way: you should set “app variable longitudes” to “Longitude…”) you should convert them to numbers like that:

2 Likes

Thanks!

Yes, this was the problem… My first latitude was 9.9312, so I was basically asking the app to set the map’s location to 9.9312 lat and 9.9312 lon.