1

I want to know if my users have Apple Watch. If many user do, so I will develop Apple Watch application extension for my iOS app. Can I know if even watch is not paired?

CHiP-love-NY
  • 507
  • 6
  • 14

1 Answers1

3

You should look at the WatchConnectivity framework. Especially, the isPaired method of WCSession should solve your problem.

In your iPhone app's application(didFinishLaunchingWithOptions:) method, set up and activate the WatchConnectivity session, since isPaired only returns a valid value for an activated session.

//Set up WatchConnectivity
if WCSession.isSupported() {
   let session = WCSession.default()
   session.delegate = self
   session.activate()
}

In func session(activationDidCompleteWith) you can check if the iPhone is paired with an Apple Watch or not using this line of code: let userHasAppleWatch = session.isPaired.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116