0

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.

user2122350
  • 53
  • 2
  • 7
  • Your scenario (it's not really a question) is so vague that it's hard to know where to start. But.... What does "flow returns" mean? What state was your app in while the 3rd-party one was running? What variables, specifically, are you talking about? – Phillip Mills Jun 23 '17 at 12:21
  • Use Strong reference for your property to prevent ARC from deallocating the referred object. – Dharma Jun 23 '17 at 12:29
  • Hi Philip, Flow means to get a measurement like BP we launch the third party app and it captures measurement and we return back from that app to our app. App uses OpenUrl to launch the third party app. Variables are state variables ,core data objects as well as other objects – user2122350 Jun 23 '17 at 12:56
  • Does "return back" actually mean relaunch or just background/foreground? Can you log the state transitions your app goes through? – Phillip Mills Jun 23 '17 at 13:21
  • Its just background to foreground. Similar to an app that launches safari and returns back – user2122350 Jun 23 '17 at 13:39
  • We have a set of objects defined as singletons. They were used to maintain the state of the app and certain parameters. They are totally lost. It shows nil to all these variables even though hovering on the singleton in Xcode shows a valid object – user2122350 Jun 23 '17 at 13:46
  • You need to show some code and a stack trace. – Paulw11 Jun 23 '17 at 14:03

1 Answers1

0

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.

user2122350
  • 53
  • 2
  • 7