我正在尝试在家中添加访问权限这是我的代码
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)
}
})
}
})
但它告诉我错误
并且无法在家里添加配件。
println("Failed to add the accessory to the home")
上面提到的语句确实执行。它不要求提供附件设置代码。