Locksmith icon indicating copy to clipboard operation
Locksmith copied to clipboard

Not working with app extension

Open andymedvedev opened this issue 7 years ago • 3 comments

I have created Action extension for the app. In app i set the field and then i want to retrieve them in extension but its failed (dictionary not found).

andymedvedev avatar May 24 '17 08:05 andymedvedev

To solve your issue, we might need to see your code. All I can say right now, is that you probably incorrectly spelt forUserAccount:, causing the dictionary not to be found.

dannymout avatar Jun 22 '17 14:06 dannymout

@andertsk

When you trying to get value from Keychain in your extension, you have to do this way:

let value = Locksmith.loadDataForUserAccount(userAccount: "user_account", inService: "__YOUR__APP_BUNDLE_ID____") Usually you have different bundle ID for app and extension. For example:

Application bundle id: com.mywebsite.myapp Extension bundle id: com.mywebsite.myapp.extension

If you try to get value without passing inService value. Like that:

let value = Locksmith.loadDataForUserAccount(userAccount: "user_account")

Locksmith will not return value, because it will use Bundle ID of the Extension. But your value has been saved under your app bundle id.

You also need to make sure, you are enable keychain share under Project -> Capabilities for app and extension target. And they both use the same group.

shuhrat10 avatar Oct 26 '17 17:10 shuhrat10

@shuhrat10 thanks! You solve my problem!

andymedvedev avatar Oct 27 '17 11:10 andymedvedev