Add Accessory to home always returns error(GenericError)

扶醉桌前 提交于 2019-12-08 12:46:44

问题


I am trying to add a accessory to Home(HMHome) and always error block is execute. I am getting GenericError which means An error occurred for which there is no more specific error code. I am not able to understand the reason of this error even documentation does not has the proper reason of it.

And This is happening since last one day, earlier i was able to add the accessory by the same code.

if (self.home != nil ){

self.home!.addAccessory(accessory, completionHandler: ({(error:NSError!) in

   if ( error != nil) {
        //Method which returns error alert according.
        self.handleError(error)
       }

  else{

   let alert:UIAlertController = UIAlertController(title: "HomeKitPOC", message: "Accessory added successfully", preferredStyle: .Alert)
   alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler:{
      (action:UIAlertAction!) in
      self.dismissViewControllerAnimated(true, completion: nil)
      }))
      self.presentViewController(alert, animated: true, completion: nil)
      }
  }))

}

Anybody who has faced the similar problem or have something to suggest.


回答1:


I got the actual root cause of this issue. The time I was trying to pairing-up with the BLE device my iPhone device was not having an active internet connection.

To add an accessory during the paring-up with BLE device, proper internet connection is needed.

So I had made sure the proper internet connection everything started working fine.



来源:https://stackoverflow.com/questions/27874067/add-accessory-to-home-always-returns-errorgenericerror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!