LatitudeFromAddress not working with iOS

In my application, I want to get Latitude & Longitude from a given address (text).
I use LatitudeFromAdress bloc:


This works fine with Android, but fails with iOS. Within iOS, latitude & longitude are always 0.
Here is my small test program:

and the aia project:
CheckGetLocationFromAddress.aia (2.7 KB)

This functionality is supposed to be OK according to: https://doesappinventorrunonios.com/

Is it related to this issue: iPhone 12: Why Location Sensor's Current Address "No Address Available"

Thanks

Yes. The core issue as I mentioned in the other thread is that the block is implemented to be synchronous because of the design on Android (this design predates App Inventor coming to MIT from Google). However, the iOS API to compute the address is asynchronous so there's no easy way to map this into the existing design.

Add an asynchronous method and deprecate the synchronous one by marking it as @Depracated.

Thanks for this clarification.
Would be good to update / mention this on https://doesappinventorrunonios.com/
Any idea on when an asynchronous implementation could be done / released?

This feature is really key in many applications (including mine :wink:).
Could you plan the implementation of this asynchronous feature and let us know when it could be achieved?
Thanks a lot

I can see what we can do about getting it into nb201.

:+1: Great

@ewpatton: What is the status of this fix? You wanted to have this fix in nb201, but I do not see it, even in latest nb202 version.
Thanks for your feedback

However, indicated that it is supported in: https://doesappinventorrunonios.com/

Hi @Jacques_Dumarest

The blocks for this are on ai2. However, for the iOS version you will need to use the companion on TestFlight. The functionality is also in the iOS build server so available to compiled apps.

The blocks you are looking for are Geocode:

component_method(2)

and the corresponding event handler GotLocationFromAddress:

Note that these blocks are in both the Android and iOS versions, so if you update your app to use them it should work on both platforms.

Thanks a lot for this updated feature allowing to get Latitude & Longitude from address on iOS.

It works for both Android AND iOS :slight_smile:

One comment: with LatitudeFromAddress, in case of address not found, I was using Screen1.ErrorOccured to trap this pb:
image
This is not working anymore with Geocode and I am now testing if Latitude and Longitude are 0 to detect if adrdress was not found. Not a real issue, but a different behaviour :wink:

The code still goes through the error path on Android. I don't think that was implemented on iOS. What platform are you observing this issue on?

Not working on iOS, and as I want to have the same code for both platform, I am testing now Latitude and Loitude values:
image

Ok. I'll take a look.

This should be fixed in the latest build from TestFlight.

Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.