homekitios-homekit

Know Admin from HMUsers array


I have an issue that When I want to add the room to the Home incase if the user is Guest then I am getting HMErrorCodeInsufficientPrivileges error. I have a view which will display after click on the button named "Add Room", My intensin is I want to detect it when the user clicked on the Add Room button and wants to display the alert without redirecting the user to Add Room View. Thank you for the valuable time. Please let me know if I am not clear.


Solution

  • Finally in iOS 9 I found this solution.

     HMUser *adminOrNot = [selectedHome currentUser];
     HMHomeAccessControl *homeContr = [selectedHome homeAccessControlForUser:adminOrNot];
    
     if(homeContr.administrator)
     {
    
     }