iosapplication-state

ios application single app mode state variables and variables defined are nil


We have an app that reads data from bluetooth devices and posts the reading back to an ios application. Based on the readings we calculate various parameters and maintain the health data of the patient. We are designing our application to function in single app mode in ipad. When we launch a third party app for measurement and when the flow returns to our application all our defined variables are returning nil.

This is crashing the entire app. Any help is appreciated.


Solution

  • Fixed By adding most of the state variables in encodeWithCoder and DecodeWithCoder. When app runs in single app mode none of the singletons are guaranteed to contain a value. So its better to encode and decode the variables and save most of the data in DB or in User defaults and do a reinitialization to get things working in the app.