问题
For production all users of my app will point at the production URL but for dev we have multiple developers and I want to create a settings bundle so the other devs can easily reconfigure their ios devices to point at their own machines. Is there a way to only have the settings bundle in the debug (aka non production) version of the app?
回答1:
I wrote a wrapper for the NSUserDefaults. In my app delegate I check compiler flags to see if we are in release or debug mode and set the default to the testing vs production environments. Then I use those same compiler flags in my logon view controllers to display/hide a button that allows our test users to select from the different enviroments that are provided via a plist I've included in the build.
So the answer is - Compiler Flags to set the default values, and debug enabled interface prompts to set developer specific values.
来源:https://stackoverflow.com/questions/8805359/is-there-a-way-to-have-a-settings-bundle-only-in-the-debug-version-of-my-app