Permanent Storage on Apple Watch

I'm looking for a way to save something in an Apple watch app that I can read later, allowing me to identify it uniquely.

At the moment, I do not see any API that would allow me to do this. The closest thing I have is to save the image in the cache, but from its simple cache, its unreliable.

My goal is to uniquely identify the Apple Watch.

Any pointers would be much appreciated.

+6
source share
3 answers

You can save information accessible from both the watch and the iPhone in NSUserDefaults and in application groups such as this:

let defaults = NSUserDefaults(suiteName: "group.com.your-bundle-id.app-group-name")

where "group.com.your-bundle-id.app-group-name" is your application group identifier.

For more information on NSUserDefaults and other ways of exchanging data between Watch and iPhone, see the architecture of your Apple Watch app.

+2
source

Custom application groups or NSUserDefaults to exchange data between your iOS applications.

Easily share small amounts of data between your iOS application and your WatchKit Extension with application groups and NSUserDefaults. To access other resources, such as the master data warehouse, use a common container between your iOS application and the WatchKit extension to simplify access data and provide relevant information.

+1
source

I think that it would be very useful not only to identify the clock, but also to speed up the loading of the user interface (without synchronizing several data via Bluetooth at the beginning).

However, at the moment, there seems to be no solution for this.

It also seems impossible to get the hardware ID of the watch.

Perhaps this will be possible as soon as ordinary third-party developers can write real applications for viewing (and not just application extensions for the iPhone). WWDC is located in June.

0
source

Source: https://habr.com/ru/post/987644/


All Articles