问题
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