Ios 我无法在watchOS 2中获得HomeKit home name和room name?
我正在开发一款集成了HomeKit的iOS和watchkit。我在iOS应用程序中添加了一些家庭和房间。现在,我想检索添加的家和房间 下面是在watchkit中回家的代码。我可以通过这个密码在iOS上回家Ios 我无法在watchOS 2中获得HomeKit home name和room name?,ios,swift2,watchkit,Ios,Swift2,Watchkit,我正在开发一款集成了HomeKit的iOS和watchkit。我在iOS应用程序中添加了一些家庭和房间。现在,我想检索添加的家和房间 下面是在watchkit中回家的代码。我可以通过这个密码在iOS上回家 var homeWatchSore : HomeWatchStore! var homeStore: HomeWatchStore { return HomeWatchStore.sharedStore } var home: HMHome! { return hom
var homeWatchSore : HomeWatchStore!
var homeStore: HomeWatchStore {
return HomeWatchStore.sharedStore
}
var home: HMHome! {
return homeStore.home
}
var homeManager: HMHomeManager {
return homeStore.homeManager
}
func registerAsDelegate() {
homeManager.delegate = self
}
// Below function is used to get Home. But it always shows 0.
func getAllHome () {
let numberOfRows = homeManager.homes.count
}
你知道如何从iOS向watchKit应用程序添加房间和家吗。你是在实际的手表上测试这个吗。我正在模拟器中测试。您无法在watchOS模拟器上测试您的HomeKit watch应用程序。它必须在苹果手表上测试。在真正的设备上试用,并让我们知道这是否解决了问题。