In my application, I am using HomeKit. You can add / remove HMHome and HMRoom objects, but I would also like to add some metadata to them. For example, in my application I want to add an icon in HMRoom and also add an array of elements to it.
My solution is that I use it in conjunction with CoreData and keep additional information about HMRoom, but there is no way to identify HMHome and HMRoom objects other than their name. This will not be a problem if my application is the only application in the world for editing HomeKit objects, but, of course, there may be other applications, as well as setting up HMHome and HMRoom objects (deleting them, renaming them).
So, I really have a problem when the user does one of the following:
- Run my application
- Add HMHome and HMRoom
- Add some metadata to the HMRoom object through my application, which is stored in my CoreData database li>
- Complete my application
- Launch another application and rename only created HMRoom.
- Launch my app again
Since there is no unknown identifier for the HMHome and HMRoom objects, I can no longer find the metadata stored in CoreData, and that the metadata is actually lost, because I can no longer match the name with the created HMRoom to the data in my CoreData Database.
So my question is: is there a way to identify HMRoom and HMHome objects other than their name?
source share