• 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: NSApplicationMain arguments [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSApplicationMain arguments [SOLVED]


  • Subject: Re: NSApplicationMain arguments [SOLVED]
  • From: email@hidden
  • Date: Sat, 12 Apr 2008 15:13:52 +0200

Thanks Ken! That worked perfectly. Still curious why tweaking the
argv[] array didn't, though. I did use a preceding dash for the key,
and so it should have been the exact same thing as the code below, no?
Anyway, here is a working example for anyone interested. Thanks again.

int main(int argc, char *argv[])
{
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	NSMutableDictionary* myValues = [NSMutableDictionary dictionaryWithCapacity:1];
	[myValues setDictionary:[[NSUserDefaults standardUserDefaults]
dictionaryRepresentation]];
    [myValues setObject:@"Bar" forKey:@"Foo"];
	[[NSUserDefaults standardUserDefaults]
removeVolatileDomainForName:NSArgumentDomain];
	[[NSUserDefaults standardUserDefaults] setVolatileDomain:myValues
forName:NSArgumentDomain];
	[pool release];

    return NSApplicationMain(argc,  (const char **) argv);
}


On Sat, Apr 12, 2008 at 12:47 PM, Ken Thomases <email@hidden> wrote:
> On Apr 12, 2008, at 5:45 AM, Ken Thomases wrote:
>
> >        [[NSUserDefaults sharedUserDefaults]
> removeVolatileDomainForName:NSArgumentDomain];
> >        [[NSUserDefaults sharedUserDefaults] setVolatileDomain:myValues
> forName:NSArgumentDomain];
> >
>
>  Oops.  s/sharedUserDefaults/standardUserDefaults/g
>
>  -Ken
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSApplicationMain arguments [SOLVED]
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Tight loop processing
  • Next by Date: Re: Override AppleScrollBarVariant on NSScroller? [SOLVED]
  • Previous by thread: dataWithPDFInsideRect doesn't clip
  • Next by thread: Re: NSApplicationMain arguments [SOLVED]
  • Index(es):
    • Date
    • Thread