error saving setting

In trying to test/modify settings got this error from simulator :

"Error Saving Settings"

"we had a problem saving settings to this device. Please try again in a few minutes." ...

what is the real problem ?

and doing the same test from the app in store : got more or less same error on the phone ....

  • Yes other apps setting on FR235 are working from the same iPhone.
    Even this app settings are working fine when app is running on FR255.

    One observation which might help:
    I deleted app settings from SETTINGS directory. Afterwards I was able to change the settings multiple times on FR235.
    After the watchface disappeared once (i.e. scrolling to the widgets) it was failing afterwards to change settings.

    The only special thing happening in App.onStop() is, that I first time write the Dictionary to the property of type string. But in the dictionary I have three arrays of Numbers which might be binary. This might break the settings.SET file for access by the properties editor?

    Do I have to serialize a Dictionary to a string ahead of storing it?  

  • I guess if it's declared as string, then it\s better to treat it as string, so serialize before write, deserialize after read

  • Its gone after I haved saved every property as string only.

    The reason might be that if you save a binary object (i.e. complex dictionary) to a property this cannot be parsed by the settings editor, neither written.

    From the documentation it gets clear that settings and other properties are not isolated: "Prior to API level 2.4.0, all content was persisted in the object store. If your app runs on Connect IQ System 1 devices, you will need to use AppBase.getProperty() and AppBase.setProperty() to persist data. These functions allow access to both settings and persisted data. The object store is one Dictionary" (source)

    Thanks for your support flocsy!

  • with getProperty and setProptery, the names are a bit misleading

    If a key is defined as a property, it's read from/saved in the .set file (settings).

    if the key isn't a property. it's read from/saved in the object store (the .str file)

  • Hi Jim, I have seen all properties in the SET file on my CIQ1 FR235. STR file almost empty.

    manualVO2max is a setting

    weekVigorous is a property not visible in settings.

    On this old devices no isolation is available.

  • You don't want to have a property for weekVigorous if you don't have an associated setting.

    Without the property, it will be in the .str file and not the .set.

    There is isolation, it's just not clear by just looking at the code in in mc file

    I started doing settings when there were only CIQ 1 devices. And used the object store (.str) before that.

  • I understand, that if I do not declare the properties i.e. weekVigorous in <properties> then it is automatically saved to .STR file and not to .SET. Thereby getting isolation. 

    I put the declaration into the <properties> because of getting an exception on newer watches:

    Error: Unhandled Exception Exception: Key does not exist in Application Properties

    Sure I could use the Storage.setValues commands, but nevertheless I stumbled in this effect we discuss here 'error saving setting'.

  • If you have it in Application.Storage. you want to do Application.Storage getValue() and not Application.Properties.getValue()  You then don't need it define as a property.

    Also, note the .str isn't used with Storange.getValue/setValue

  • Hi,

    want to try a summary: 
    if you want to create a application working with all API level watches the strategy would be to:

    * Declare property and settings only for setting reasons and access via either AppBase.get/setProperty or Properties.get/setValue
    * for storing complex data structures do not declare properties and access either via 
    AppBase.get/setProperty or Storage.get/setValue

    API Level 1.0.0: AppBase.get/setProperty
    API Level 2.4.0: Storage.get/setValue
    API Level 2.4.0: Properties.get/setValue

    This way you:
    a.) avoid error saving settings from settings editor 
    b.) avoid 
    Error: Unhandled Exception Exception: Key does not exist in Application Properties
    c.) are able to store complex data types even on API Level 1.0.0 devices.

    Would you agree?