Is there a programmatic way to discover whether my app is talking to the CloudKit Development or Production environment?
(I know I can look at the com.apple.developer.icloud-container-environment
key in Entitlements.plist to make an intelligent guess, but that doesn't really -prove- which environment I'm using.)
I can think of 2 ways to do that:
You could create a settings recordType and add an environment variable. Then make sure there is only 1 record in it, both on production and development. On development set the environment variable to development and on production set that variable to production. Then in your app just read that record to see what environment you are in.
There is a way that does not rely on data manipulation and that is this: Try to create a new random field name in a dummy recordType. On development that will just work. On production you will get an error.