Reputation: 405
I want to print out every hmCharacteristic's value in my Smart Home and therefore created this screen (code see below).
Unfortunately, I am always getting these two errors whenever I try to call the HmCharacteristic.readValue()
function (error messages see below).
I am using a physical test iPhone with a real HomeKit Smart Home (no HomeKitAccessorySimulator).
I am also using a paid apple developer Account and did enable the HomeKit entitlement as well as allowed the app to use HomeKit data on my test iPhone.
My question is: Why do I get the bundleId is invalid
and XPC not entitled
errors and how do I fix them?
import SwiftUI
import HomeKit
struct screen: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.padding()
}
init() {
let hmHomeManager = HMHomeManager();
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
for hmHome in hmHomeManager.homes {
for hmRoom in hmHome.rooms {
for hmAccessory in hmRoom.accessories {
for hmService in hmAccessory.services {
for hmCharacteristic in hmService.characteristics {
Task {
hmCharacteristic.readValue { error in
print("\(hmHome.name)/\(hmRoom.name)/\(hmAccessory.name)/\(hmService.name)/\(hmCharacteristic.localizedDescription) = \(hmCharacteristic.value ?? "[[nil]]")")
}
}
}
}
}
}
}
};
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
screen()
}
}
validateSessionInfo: bundleID is invalid. Please specify the bundleID for kRTCReportingSessionInfoClientBundleID
initWithSessionInfo: XPC not entitled, 1
Upvotes: 1
Views: 58