【问题标题】:Add Accessory to home always returns error(GenericError)将附件添加到主页总是返回错误(GenericError)
【发布时间】:2015-01-10 07:53:36
【问题描述】:

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

这是从前一天开始发生的,早些时候我能够通过相同的代码添加配件。

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)
      }
  }))

}

遇到过类似问题或有什么建议的人。

【问题讨论】:

    标签: swift ios8 xcode6.1 ios-homekit


    【解决方案1】:

    我得到了这个问题的真正根本原因。 当我尝试将我的测试 iPhone 设备与 BLE 设备配对时。它没有有效的互联网连接。因此,我收到了上述错误。

    为了在与 BLE 设备配对期间添加配件,非常需要正确的互联网连接。

    一旦有正确的互联网连接,一切都开始正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-30
      • 1970-01-01
      • 2012-02-26
      • 2014-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多