Question

We develop an ecommerce app. For convenience when developing, we want to automatically populate the username & password that corresponds to whatever account we prefer on our ecom servers.

The best solution I could come up with so far is: When debug mode is active, get the username and password from a plist file called debug-credential.plist.

To avoid checking this into git I have to put this file in gitignore.

I also have to add this to the Xcode project navigator so that the framework can find this file when I look for it in the bundle.

So, the problem is, I want this file to be optional. If it's not there, and my app can't find it, just don't populate the password.

No problem, except that the project file I have committed is expecting the debug-credential.plist file and can't find it, therefore won't compile. It would be fine to have the plist file with empty fields checked-in except when the dev wants to specify their own ecom credentials, then git will want to check this in.

Basically I want a way to have a local file, ignored by git, where I can put optional params for my app, and have it so that if a dev checks out a fresh clone, and does not create that file, the app will still run, but just won't have access to the parameters.

Thanks!

Was it helpful?

Solution

I also have to add this to the Xcode project navigator so that the framework can find this file when I look for it in the bundle.

You don't have to, instead add a shell script to Build Phases to copy files from anywhere to the app bundle, e.g.

ditto -V ./Secret/ "$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top