Retrieving items from iOS keychain


I'm attempting to pull an item out of the Keychain using my Xamarin application, the initial value in the keychain was placed there using a native Objective C application and the KeychainItemWrapper under the key kSecAttrAccount.
The Xamarin version of the app is v2 and has the same bundle ID and is signed with the same keys, so shouldn't have problems accessing the app sandbox.

Can anyone help me pull the value out, I've tried the Xamarin keychain sample, but have still had no joy.

Thanks in advance,



  • adamkempadamkemp USInsider, Developer Group Leader mod

    What are you trying?

  • Hi Adam,

    I've just pulling and retrieving values using this sample:
    I've used the same key that was used in the iOS application but I feel like the KeychainItemWrapper is adding some additional complexity that the Xamarin Keychain sample isn't doing.

    Any ideas?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    I don't know what you mean by KeychainItemWrapper. That's not a class I'm familiar with. I'm certain that the Xamarin wrapper can work, but there are a lot of things you can do that can make testing difficult. For instance, if you delete all the apps from your company before installing the Xamarin test then the keychain entries will be wiped. Also, you could have accidentally changed your group ID. Or you could just be using the keychain API incorrectly. I don't know how to help you more specifically than that without some specific way for me to test what you're testing.

  • Hi Adam,

    KeychainItemWrapper is a helper class from Apple that simplifies the process of adding items to the Keychain (

    Is it possible to manually change the group ID that the app accesses?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    The group ID I think comes from the provisioning profile.

  • adamkempadamkemp USInsider, Developer Group Leader mod

    Also be aware the the simulator behaves differently with respect to group IDs. Test this stuff on a device.

Sign In or Register to comment.