From watchOS >= 2.2, iOS >= 9.3 iOS device is able to connect with multiple watch devices via sessionDidDeactivate:
, sessionDidBecomeInactive:
.
However there is no identity provided in these delegate calls.
Is there any system way to identify different connected watches.
Do I have to manipulate it manually?
For example, check if newly connected watch has an identity, if not give it new id.
After received an id, the watch also need to save it somewhere. NSUserDefaults
sounds to be a good place in this situation.
From the WCSession
documentation, Apple recommends storing watch-specific data into the watchDirectoryURL
location and communicating this information with the connected app via the WCSession
Your iOS app can use the watchDirectoryURL property to store data that is specific to only one instance of your Watch app running on a particular Apple Watch. In most cases, the data you display in each instance of your Watch app is the same. However, you might use this directory to store configuration data, preferences, or other data files that your iOS app needs to interact properly with your Watch app. If you do, use the activation and deactivation process to update your iOS app.
You could store a UUID or similar unique identifier in this location to differentiate watches.