Accessing Apple Watch Keychain Data

As the title of the question, I just want to access the data stored in the keychain on the iPhone from Apple Watch. I can do it? And How?

+6
source share
3 answers

Since watchOS 2.0 shares the key fob elements between the watch and the paired device, it is no longer possible. The watch and paired device are now considered independent. You can use WatchConnectivity as a workaround.

https://forums.developer.apple.com/thread/5938

+2
source

The Watchkit application is an extension that runs on a paired phone, so you can share Keychain data just like you can share a connection with any other extension - by activating Key Sharing in your application capabilities.

See Share between iOS extension and containing keychain application?

+3
source

The way to do this is to use application groups and NSUserDefaults. Click on your main target project, find "Features" and then "Application Groups"

enter image description here

Create a group with the name of your project, group.myproject, so you can share data through Watch and iPhone. In code, you can use this to get the value:

NSUserDefaults *standardUserDefaults = [[NSUserDefaults alloc] initWithSuiteName: <YOUR_APP_GROUP>]; NSString *value = [standardUserDefaults objectForKey:YOUR_KEY]; 
-1
source

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


All Articles