18
votes

I have an iOS app where I have some settings in the iOS app related to the watch. I only want to show them if the user has an Apple Watch that's compatible with my app.

In WatchConnectivity I can query WCSession's isPaired property to see if the user has a watch but I can't figure out how to determine the watchOS version (it needs to be >5.0 to use my app).

Is there a way to determine the watchOS version from the iOS app?

1
I do not think you can check the watchOS version from iOS. However, you could communicate between the watch app from iOS app to get information you need.Lei Zhang
Thanks but I'm still not able to tell the difference between a user who has a watch on watchOS 4 and can't install the watch app vs a user on watchOS 5 that can install the watch app but hasn'tStephen
@Stephen try to get from bluetooth info you are interested in Link1 Link2George
interesting idea, unfortunately the watch seems to have special handling where it's not available through the standard bluetooth methodsStephen
Why don't you just restrict the watchOS Deployment Target to be 5.0 ?Starsky

1 Answers

-1
votes

Here are two possible solutions. Number 1 checks for the OS which if I understand your question you already know, but then 2 checks for the OS version which is WatchOS 5.0 and later. This is what I have done so I hope it helps you.

1.

#if os(watchOS)
    ...your code          
#endif
  1. if #available(watchOS 5.0, *) {
        ...your code
    }