r4id4
r4id4

Reputation: 6077

Watch OS keychain sharing

Is it possible to access the shared keychain in WatchOS 4+? I've set the exact same Keychain Sharing > Keychain Group of the iOS app (which syncs perfectly with a MacOS app), but all it finds is an empty object.

I'm using this library (https://github.com/kishikawakatsumi/KeychainAccess) which works really well on iOS and MacOS, but not on WatchOS.

I shared the Target Membership of the classes involved to the Watch Extension (and I think it works, otherwise it would throw an error that was able to get the method or so), added the pod to watchOS like this

use_modular_headers!

def shared_pods
    pod 'KeychainAccess'
end

target 'Watch Extension' do
      platform :watchos, '4.0'
      shared_pods
end 

My question is: am I missing some configurations? It looks like it is able to access the local keychain, but cannot sync with the shared one.

Thanks

Upvotes: 5

Views: 1053

Answers (1)

Gabe Hoffman
Gabe Hoffman

Reputation: 21

I was attempting to do the same thing, and it's a great pod to use to make the keychain easy to work with. However the part that needs to work is the iCloud Synchronizing for it move the data like you are thinking.

According to the current Apple Docs, in the notes under the Storing Data Securely in the Keychain

NOTE

The kSecAttrSynchronizable key is not available in watchOS.

Without that, the WatchOS can not get the keychain data you have stored over on the iOS side. So you're doing the pods right, and it's a good pod, but WatchOS doesn't want us doing that.

TLDR; - You can't do it at this time.

Upvotes: 2

Related Questions