4

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!

jpswain
  • 14,642
  • 8
  • 58
  • 63
  • why dont you keep the file always and parameter always and just play with the values....basically if you dont want the user logged in keep parameters 'nil' and otherwise fill them with values? – Jatin Jun 18 '13 at 19:22
  • Maybe this SO post can help you http://stackoverflow.com/a/2270446/2315974 – danypata Jun 18 '13 at 19:27

1 Answers1

1

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"
A-Live
  • 8,904
  • 2
  • 39
  • 74
  • this is great, but one more thing... how can I associate this with only one Build Config or one Scheme? I don't want it copied if building for Release, only for Debug. – jpswain Jun 19 '13 at 00:19
  • never mind! figured it out: http://stackoverflow.com/questions/17181125/in-xcode-how-can-you-check-environment-variables-to-know-which-build-configurat – jpswain Jun 19 '13 at 00:56