Search code examples
xcode4

understanding environment variable, arguments, and module names in manage schemes in xcode4


I am quite new to objective-c and xcode4 and I am trying to understand how things work. In particular I was playing with the "manage scheme" panel and wondering where I could use the entry declared in there.

  1. "Arguments passed on launch"
  2. "Environment variables"
  3. "Module name to debug load symbol for"

After having tried unsuccessfully to understand the purpose of that entries, I have then tried to put few sample values, but I was unable either to recall them from Xcode 4 than use them within project code (objective-c).

So I am completely missing the use of them.


Solution

  • The scheme editor controls how Xcode runs your application. It does not have anything to do with your project's code.

    The arguments passed on launch section is for command-line applications. It lets you pass arguments to the application. You would not use this section for a Cocoa or iOS application.

    The environment variables section lets you set environment variables when running your project. Mac OS X has a bunch of environment variables that help during debugging. As an example the MallocScribble environment variable fills a memory location with garbage values after you free it, which can help you detect when you're writing to freed memory. The Diagnostics section of the scheme editor has checkboxes to set common environment variables.

    The module names to load debug symbols section lets you specify modules that should load debug symbols when you debug your application. You would use this section if you wanted Xcode to load an external library or framework's debug symbols when debugging your project. The external library or framework must have debug symbols for loading them to have any effect.

    If you're writing a Cocoa or iOS application, you do not have to fill in the three sections. Setting environment variables and loading debug symbols for certain modules can help you debug your application.