Reputation: 235
I am working on an app which consists of an Apple Watch component. Once the iPhone app is launched, it will send information (device id, IP address, etc.) to Apple Watch via the WatchConnectivity
framework and data will be stored to user defaults. The Apple Watch will use the information to send data to the server. But in some scenarios, the values from NSUserDefaults
returns as "null
".
For example
Please give some suggestions for storing data on Apple Watch permanently and without being dependent on iPhone every time.
Upvotes: 2
Views: 159
Reputation: 4011
I am storing stuff in the watch's filesystem by serializing/deserializing my custom objects by implementing NSCoding
and using NSKeyedArchiver
and NSKeyedUnarchiver
.
Upvotes: 3
Reputation: 54726
Depending on the complexity of the data you want to store, it might be worth using a database framework (i.e. Realm or CoreData) to store persistent data on the watch.
Upvotes: 2