我想用多个参数在 ViewDidLoad 方法中调用一个函数。但它显示了错误
调用中缺少参数“didFindNewAccessory”
这是我的代码:
override func viewDidLoad() {
addaccessory(self)
}
func addaccessory(browser: HMAccessoryBrowser, didFindNewAccessory accessory:HMAccessory){
print("Found new accessory")
home?.addAccessory(accessory, completionHandler: {
error in
if error != nil {
print("Failed to add it to home")
}else{
print("Successfully Added")
self.home?.assignAccessory(accessory, toRoom: self.room!, completionHandler: {
error in
if error != nil{
print("Unable to add to room")
}else{
print("Successfuly added to ropom")
self.findOrCreatedServioceGroup()
}
})
}
})
}