I have a depended watch app bundled with my iOS app.
// ...
<key>WKRunsIndependentlyOfCompanionApp</key>
<false/>
// ...
My code:
guard WCSession.isSupported() else {
return
}
let session = WCSession.default
session.delegate = self
session.activate()
public func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
// ...
if (session.activationState == .activated) {
let log = Log(isPaired: session.isPaired, isWatchAppInstalled: session.isWatchAppInstalled)
uploadLogToServer(log)
}
// ...
}
and also:
guard WCSession.isSupported() else {
return
}
let session = WCSession.default
guard session.activationState == .activated, session.isWatchAppInstalled else {
return
}
do {
try session.updateApplicationContext(...)
} catch {
uploadErrorToServer(error)
}
What I've observed is that when I query the logs in the server's database, I get entities with isPaired = false and isWatchAppInstalled = true.
Also, when I query the errors I see deviceNotPaired errors.
So my question is, does Should WCSession.isPaired property be true before accessing WCSession.isWatchAppInstalled property ?