not overloaded onSettingsChanged() bug with IOS ?

Hi,

A user reports that my widget crash when he edits settings in GarminIQ with the widget running. He has Garmin Fenix 5 plus and an Iphone X (up to date).
I have Android, and don't reproduce the issue, neither on the simulator.

I didn't overload onSettingsChanged() in my code. I just overload it and will publish new version to check if it solves the issue.

Sorry I doesn't have the log file of the crash...

Regards.

  • The ERA tool say it's on the last line...

    Honestly, you are right it could, I simplified the test to save memory Sweat smile
    Initially it was :

    if (AppBase.getProperty("Version") !=null && ! AppBase.getProperty("Version").equals("1.2.3"))

    But this property have a default value configured, and I did it after doing lot of test with my watch and the simulator ...

  • The ERA tool say it's on the last line...

    Sure I believe you, but it's the most likely answer, and it can't hurt to at least try to revert that change.

    Believe me, I'm all about saving memory. If you want to save memory, you could:

    1) Create a wrapper function for getting properties which does type-checking and null-checking. (There are already known issues where getProperty() returns the wrong thing - see the new developer faq. The most egregious one that I encountered is when a user enters a non-numeric value in a numeric setting -- in that case, Garmin Connect sends null for the property instead of the default value or the previous value. I don't think they ever changed that behavior, but I'm not sure.)

    2) Rewrite the check as:

    !("1.2.3").equals(AppBase.getProperty("Version"))

    I checked real quick in the sim, and something like ("1.2.3").equals(null) does not crash but evaluates to false. (At least in the sim. But you could test that on your watch, too.)

  • ;o)

    I rewrote this code during the intervall of your message :

    		var currentversion = "1.2.2.4";
    		if (! currentversion.equals(AppBase.getProperty("Version"))) {
    			display_releaseMessage = true;
                ...
                AppBase.setProperty("Version", currentversion);
    

    Thanks for your advices. I add already a wrapper (json parser) to check all settings that the user can edit.  For this one it's only for internal purpose, not editable by the user.

    I will see if it correct some crashes. I'm starting to wondering if the user described me well the issue ... because he said that the crash only appears when he edits the settings on ConnectIQ during the widget is still running. But I checked, that doesn't call the initialize() method... Very strange...

    Well with this two patch, I will see if it's better. Thanks again for your help.