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