In my application I am using HomeKit. You can add/remove HMHome and HMRoom object, but I would also like to add some metadata to them. For example in my application I want to be able to add an icon to a HMRoom and add an Array of items to it too.
My solution is that I use it in combination with CoreData and store the extra information about the HMRoom, but there is no way to identify the HMHome and HMRoom objects, other than their name. This would not be a problem if my application would be the only application in the world to edit the HomeKit objects, but of course there could be other applications, also adjusting the HMHome and HMRoom objects (removing them, renaming them).
So I would really have a problem, when the user does one of the following things:
- Start my application
- Add a HMHome and HMRoom object
- Add some metadata to the HMRoom object, through my application, which is stored in my CoreData database
- Quit my application
- Start another application and rename the HMRoom they just created
- Start my application again
Because there is no known identifier for the HMHome and HMRoom objects, I cannot find the metadata I stored in CoreData anymore and that metadata is actually lost, because I can no longer match the name with the created HMRoom with the data in my CoreData database.
So, my question is: Is there a way to 'identify' HMRoom and HMHome objects other than their name?