gpt4 book ai didi

ios - 添加 homeKit 附件错误警报

转载 作者:行者123 更新时间:2023-11-29 10:35:50 26 4
gpt4 key购买 nike

我正在尝试在主页添加 accesrroy 这是我的代码

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

let strongSelf = self!

if error != nil{
println("Failed to add the accessory to the home")
println("Error = \(error)")
} else {
println("Successfully added the accessory to the home")
println("Assigning the accessory to the room...")
strongSelf.home.assignAccessory(accessory,
toRoom: strongSelf.room,
completionHandler: {(error: NSError!) in

if error != nil{
println("Failed to assign the accessory to the room")
println("Error = \(error)")
} else {
println("Successfully assigned the accessory to the room")

strongSelf.findServicesForAccessory(accessory)

}

})
}

})

但它告诉我错误

aelrt

无法在主页添加配件。

  println("Failed to add the accessory to the home")

上面提到的语句确实执行了。它不要求配件设置代码。

最佳答案

您所解释的内容对找到确切原因不太有帮助,我多次遇到同样的错误,错误日志不充分,但我通过以下步骤修复了它。

  • 重置模拟器或删除您的应用
  • 运行您的应用程序并再次尝试添加配件。

根据我的理解,只有这个错误 出现在模拟器环境中,因为您将在真实设备上运行应用程序并使用真实配件而不是 Home Kit Accessory Simulator 测试它,此问题可能不会出现(尚未在设备上测试)。

希望对您有所帮助。

关于ios - 添加 homeKit 附件错误警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27170388/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com