Persistent Configuration on the device (iOS Swift)

During a device scan and initial connection, I am connecting to the device and calling setConfigurationAsync to assign a new configuration object to the Meta Wear device.  Everything is ok here and the method runDeviceBoot executed properly.  I’m calling rememberDevice so this is saved.  I can kill my app, restart it, connect to the device and retrieve my configuration via device.configuration call.  The issue is that when I call downloadLogAndStopLoggingAsync to download the activity data, I lose the configuration object that I had previously assigned to the device.  This occurs when I kill my app and re-connect to the device….calling device.configuration returns nil.  if I don’t call downloadLogAndStopLoggingAsync, I can connect to the device, and the configuration object assigned is returned properly.  The “stopLogging” parameter is NO for the downloadLogAndStopLoggingAsync call.  Question is, do I need to re-set my configuration object after a call to downloadLogAndStopLogging?  I don’t see this being done in their ActivityTracker sample.  


  • mlin34,

    The answer to your question is no, you should not have to re-set the configuration.  The only thing that should clean a configuration is a call to setConfiguartionAsync(nil).

    I was unable to reproduce the error you described on my end, so I'll need a little extra information.  Can you confirm that your are never calling setConfiguartionAsync(nil)?
  • Yes I can confirm that I am not calling setConfigurationAsync(nil)

    I only call that method once and that's to set a new configuration object to the device.  It seems to be cleared after a call to downloadLogAndStopLogginAsync and then terminate the app (kill it from the background as well).  when I restart it and reconnect to the device, the configuration is nil.

  • Hi,
    this is still an issue for me.  Do you have a SWIFT example of storing and retrieving a device configuration?  
  • Can you confirm what version of iOS SDK you are using?
  • SDK is 10.3
  • And what MetaWear SDK version?
  • Please check out the FitnessTracker app which I re-wrote in swift.  I was unable to reproduce any issues using the latest MetaWear SDK.

    It's worth noting that there really is no difference between Swift/Obj-C apps since there is only 1 MetaWear SDK written in Obj-C and bridged to Swift.
This discussion has been closed.