0
我在Add HomeKit Accessory Alert
(图1)中按Add Anyway
约6秒后出现Add Accessory View Controller
(图2),这个问题在等待时间较长时出现问题。 (Xcode的8.2-β,部署目标:10.0,设备IOS时:10.1.1)为什么在长时间延迟后出现“添加附件”视图控制器?
的代码是相当简单:
home
是HMHome
accessory
是HMAccessory
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
defer {
tableView.deselectRow(at: indexPath, animated: true)
}
let accessory = accessories[indexPath.item]
home.addAccessory(accessory) { error in
// ...
}
}
我已经尝试将代码包装在DispatchQueue.main.async { /**/ }
中,但不会将演示文稿固定。
这只是一个问题,因为附件是不是(还)认证,还是我忘记配置/等待的东西之前,我可以叫addAccessory
安全?
注:我在HomeKit example provided by Apple
Figure 1: Add HomeKit Accessory Alert
Figure 2: Add Accessory View Controller
这不是一个需要时间准备的问题 – SRI