Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with app extension #174

Open
andymedvedev opened this issue May 24, 2017 · 3 comments
Open

Not working with app extension #174

andymedvedev opened this issue May 24, 2017 · 3 comments

Comments

@andymedvedev
Copy link

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).

@dannymout
Copy link

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.

@shuhrat10
Copy link

shuhrat10 commented Oct 26, 2017

@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.

@andymedvedev
Copy link
Author

@shuhrat10 thanks! You solve my problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants