Q:

How to save a key value pair that can be accessed by all apps (globally)

I want to save some alpha-numeric value that needs to be accessed by 2 or more apps. 
NSUserDefaults is only for within the same app, so I was wondering if there was something similar which can save key value pairs globally.
Additional info: I'm using my first app to save the UDID or some unique key on my phone, so that Appium can later access it. 

A:

You can use Shared User Defaults  -   iOS8+
As long as all your apps are in the same 'App Group' and use the same 'SuiteName' and keys - they can share info there.
Using it is as simple as using regular UserDefaults - you just need a little more setup.
You can find a good guide here:
https://medium.com/ios-os-x-development/shared-user-defaults-in-ios-3f15cd2c9409

