Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 我无法在watchOS 2中获得HomeKit home name和room name?_Ios_Swift2_Watchkit - Fatal编程技术网

Ios 我无法在watchOS 2中获得HomeKit home name和room name?

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

我正在开发一款集成了HomeKit的iOS和watchkit。我在iOS应用程序中添加了一些家庭和房间。现在,我想检索添加的家和房间

下面是在watchkit中回家的代码。我可以通过这个密码在iOS上回家

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应用程序。它必须在苹果手表上测试。在真正的设备上试用,并让我们知道这是否解决了问题。