• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Passing non-string user defaults through command line arguments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing non-string user defaults through command line arguments


  • Subject: Re: Passing non-string user defaults through command line arguments
  • From: Christiaan Hofman <email@hidden>
  • Date: Wed, 06 Apr 2011 01:48:35 +0200

On Apr 6, 2011, at 1:35, Justin C. Walker wrote:

>
> On Apr 5, 2011, at 16:16 , Chris Suter wrote:
>
>> Sorry, I meant to send this to the list
>>
>> ---------- Forwarded message ----------
>> Hi Christiaan,
>>
>> On Wed, Apr 6, 2011 at 2:53 AM, Christiaan Hofman <email@hidden> wrote:
>>> Sometimes I want to test my app with a particular value for a user default.
>>> I do this by adding a command line argument (in the info for the executable
>>> in Xcode) for the user default key. This works for string values, however
>>> when the value needs to be something else (e.g. a boolean), I cannot get
>>> this to work. Is there a way to do this?
>>
>> Yes.
>>
>> // Using XML
>> -argument '<integer>1</integer>'
>> // Using old style (probably deprecated)
>> -argument '(one, two, three)'
>
> Unless I misunderstand this, the program still has to know, or be told, that the (string!) arguments have to be translated/interpreted as the specified "objects".  It is not the case that the code can look something like
>
> main(argc, argv)
> {   int i;
>    i = argv[2];
>    ...
> }
>
> when called with, e.g.,
>
> $ foo -argument '<integer>1</integer>'
>
> We maybe should have resorted to a specific example earlier in this thread, to help the discussion.
>
> Do we agree on this?  Am I missing something (like a change in the technology since last I waded into this area)?
>
> Christian: is this something like what you are asking about?  If not, can you give a short snippet that shows what you want?
>
> Justin

Again, it's not about the type of the raw *shell* arguments. It's about how the *app* interprets the argument values as *Cocoa* objects. So I'm talking about NSArgumentDomain, not about the raw arguments.

I find it very hard to find documentation on this. All I can find is a very short paragraph about NSArgumentDomain, which is in fact wrong (it says I can pass NO as a value, but that is not working in practice).

Christiaan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Passing non-string user defaults through command line arguments
      • From: Howard Moon <email@hidden>
    • Re: Passing non-string user defaults through command line arguments
      • From: Chris Suter <email@hidden>
References: 
 >Passing non-string user defaults through command line arguments (From: Christiaan Hofman <email@hidden>)
 >Fwd: Passing non-string user defaults through command line arguments (From: Chris Suter <email@hidden>)
 >Re: Passing non-string user defaults through command line arguments (From: "Justin C. Walker" <email@hidden>)

  • Prev by Date: Re: Passing non-string user defaults through command line arguments
  • Next by Date: Re: Passing non-string user defaults through command line arguments
  • Previous by thread: Re: Passing non-string user defaults through command line arguments
  • Next by thread: Re: Passing non-string user defaults through command line arguments
  • Index(es):
    • Date
    • Thread