setReadPermission

Hello,

I developed for my students a very simple application to search a database of French postal codes. The application works very well on Android, but crashes on iOS with the following error message : Error from Companion : unrecognized method (irritants : setReadPermission).

Attached is the application file.

Does anyone have an idea of the problem and a workaround?

Thank you in advance for your interest in my problem.

Dominique
zip_codes.aia (602.9 KB)

The ReadPermission property was added recently to the Android version to support changes Google made in newer versions of Android around the read/write permissions for external storage. These "permissions" haven't made their way into the iOS version yet, so if you want the app to work cross platform you'll need to turn it off.

Thank you for your very very fast response.
The error message has disappeared, but the application still crashes. I think the problem is reading the database files. I have of course read the documentation on the File control, but it's not very clear to me how to create an application that works on both Android and iOS and can read text files.

Hello,

I posted a message yesterday about an app that works on Android, but not on iOS, and Evan kindly replied immediately with the source of the error.

After disabling the ReadPermission property, the app unfortunately still crashes. Since I suspected a problem with the File control on iOS, I modified my program to remove this control (I placed the file contents directly into variables, something I often do with Blockly, since there is no block to load files). The program still works on Android, but not on iOS where a connection problem is reported. However, the iPhone and the PC are on the same Wi-Fi network...

You will find attached the application file. If someone can test it on iOS and tell me if it crashes, I would be grateful.

Dominique
zip_codes_ios.aia (593.9 KB)

Yes, confirmed at least on an iPhone 6s (iOS 15.0.2).

See here: :upside_down_face:
Length can be reduced by at least 75% removing duplicates.

Thank you very much for confirming that my application crashes, even if it is not good news...
I can't delete duplicates because I simulate with my lists a database with a 1 to many relationship (one zip code is related with many towns...).
Dominique

Ok, try to store the file (list of codes) in the assets and read it from there. Then it is not necessary to split this very long text (string).

That was what the first version of my application did, which crashed because of the ReadPermission property.
But anyway, the content of the files will end up in lists. And I still don't understand why the application works on Android and not on iOS...

Why should READ permission be requested for the assets?

There is no reason and it was a mistake on my part.
But disabling the property does not solve the problem.
Personally, I find that the documentation is not very clear about the use of the File control and that's why in the second version of my application I got around the problem by placing the contents of the files directly into variables. Even if the files are almost 40,000 lines long, they are not huge either.

Auf jeden Fall ist es sehr nett von Ihnen, dass Sie sich die Zeit nehmen, um zu versuchen, mein Problem zu verstehen.

Hello,

I finally understood why my app crashes on iOS, while it works fine on Android.

My application uses 4 lists of 39193 items:

  • A list for cities (a 521 Kb text file)
  • A list for postal codes (a 267 Kb text file)
  • A list for latitudes (a 530 Kb text file)
  • A list for the longitudes (a 538 Kb text file)

My application crashes on iOS because there are too many items in these lists. When I reduce these lists to 999 items, my application runs perfectly.

I have attached the new app file (if you want to test the app, enter the zip code 01100 and click the Find zip code button).

So there is a limitation in iOS in the number of items in lists or in the size of the number of items in memory. It would be interesting to know this limit which, a priori, is not documented.

Dominique
zip_codes_small.aia (21.1 KB)

There shouldn't be a hard limit on the number of entries. There will be a soft limit depending on the amount of RAM in the device. I'll take a look at the crash and see what's going on.

Thanks. I think this will be a valuable informations for iOS developers, but the limit seems to be very low.

Ok. So the issue is that the function that splits the string is not being optimized into a tail-recursive call. The lack of optimization causes the thread to run out of stack memory. I need to figure out why the call isn't being optimized but if we can solve that it should fix the issue.

4 Likes