Homekit delegates stop notificating after the app running for a long time.

Hi.


I've develop an iOS app to manage somo homekit accesories that works for a long time (all the night) in a screensaver mode and I've notice that after a period of time HMAccessoryDelegate stop recibing updates from changes made with other device.


Now I read all accesory value on screensaver unloaded and they are correctly update, but delegates don't recibe notification of any external update.


I've check that if I open homekit app or just homekit from control center the delegates starts again to recibe notifications for another period of time.


It's there any limit of time? Can I aweak all the procces like opening homekit app but programaticcaly? Can I get notified in other delegate when homkit stops updating notifications...


For more details, the app is installed on an iPad(4th generation) with iOS 10, and I have an Apple Tv 4 gen in house and 2 iPhones with iOS 11

Replies

I don't know the answer to your question, but your results do not surprise me. In fact I'm surprised that you get much time at all during which you get updates.


I'd like to expand the question, because I'd like to better understand what happens when you call the homemanager. When the homemanager is called and returns with homeManagerDidUpdateHomes, there is a period of time during which you can read characteristics of the various accessories and attempt to set them. After some amount of time, and this is where I'm uncertain, you can no longer directly access the same accessories and characteristics - you have to call the homemanager again. Whatever link you had to the HomeKit database seems to be temporary, and the HMCharacteristic you have identified in your app is not a reference that is good forever, it becomes "obsolete". You have to call the homemanager again if you want to deal again with that accessory and characteristic.


Is there some documentation of how this all works, in particular the timing issues? For instance when you attempt to set a characteristic's value, what determines how long it takes to come back with an error when the attempt fails? Does it time-out?