I am looking for a way to store something on the Apple watch app that I can read later on enabling me to identify it uniquely.
I don't see any API at the moment that would let me do this. The closest I have got is to save an image in cache but since its just a cache, its not reliable.
My goal is to uniquely identify an Apple Watch.
Any pointers would be much appreciated.
You can save information to be accessible from both watch and iPhone in NSUserDefaults and App Groups like this:
let defaults = NSUserDefaults(suiteName: "group.com.your-bundle-id.app-group-name")
where "group.com.your-bundle-id.app-group-name"
is your app group identifier.
For more details about NSUserDefaults and other ways to share data between Watch and iPhone see Architecting Your App for the Apple Watch
User App Groups OR NSUserDefaults to share data between your iOS apps.
Easily share small amounts of data between your iOS app and your WatchKit extension with App Groups and NSUserDefaults. For access to other resources, such as a Core Data store, use a shared container between your iOS app and your WatchKit extension to simplify data access and provide up to date information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With