将附件添加到家庭总是返回错误(GenericError) [英] Add Accessory to home always returns error(GenericError)

查看:84
本文介绍了将附件添加到家庭总是返回错误(GenericError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向Home(HMHome)添加附件,并且始终执行错误块.我收到GenericError,这表示发生了一个错误,没有更具体的错误代码. 即使文档没有正确的原因,我也无法理解此错误的原因.

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.

推荐答案

我知道了此问题的实际根本原因. 当我尝试将测试的iPhone设备与BLE设备配对时.它没有有效的互联网连接.因此,我遇到了提到的错误.

I got the actual root cause of this issue. When I was trying to pairing-up my testing iPhone device with the BLE device. It was not having an active internet connection. Due to this I was getting the mentioned error.

并且为了在与BLE设备配对期间添加附件,非常需要适当的Internet连接.

And in order to add an accessory during the paring-up with BLE device, a proper internet connection is much needed.

一旦互联网连接正确,一切都会开始正常运行.

Once there was the proper internet connection, everything started working fine.

这篇关于将附件添加到家庭总是返回错误(GenericError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆