views:

254

answers:

1

My guess is that the answer is "no", but I figured I'd ask anyway.

Lets say that I have a shared library that multiple applications build into their executables. Now lets say that this shared library provides an API to some web service that uses the same username/password for all n number of applications that use the library.

Is it possible then to set the username/password in one place such as the system settings and allow multiple applications to access the settings, or is NSUserDefaults still completely sandboxed?

This seems like the sort of thing that the keychain is for, but can you use it for arbitrary data vs. just authentication data? Can a settings bundle be used to change keychain data shared between apps with the same apple id prefix?

+2  A: 

You can store arbitrary data in the keychain, and I swear that I read somewhere that apps with the same bundle ID root can share a keychain. Can't for the life of me find the reference now.

Maybe I dreamt it.

EDIT
I'm pretty sure it was in the KeyChain Services doc, but all references to it seem to be gone.
At the time I thought it was so interesting that I jotted it down:

can use "bundle seed id" to share keychain access between multiple apps w. a single app ID

That's it. I haven't checked it out yet, so I'm not sure if it means you can make and distribute several apps that use one keychain, or if it just means that successive versions of one app see the same keychain.

I'd love to be able to find the original reference.

Here's a developer forum post that says it's possible.

Rhythmic Fistman
Thanks. Actually the Manage AppIDs tab on the program portal (with all the certificate and provisioning stuff) says: "The Bundle Seed ID portion of your App ID can be utilized to share keychain access between multiple applications you build with a single App ID. In addition, it can be incorporated into any external hardware accessories you wish to pair your iPhone OS application with." Anyway, thanks! It sounds like I could probably implement a NSUserDefaults workalike that uses the keychain as a store, or something.
Nimrod