Re: Enabling NSZombieEnabled programatically
Re: Enabling NSZombieEnabled programatically
- Subject: Re: Enabling NSZombieEnabled programatically
- From: Dave Keck <email@hidden>
- Date: Sat, 9 Jan 2010 16:12:20 -1000
> OK, seems to be that way. So how do I do that from within my app? I tried
setenv("NSZombieEnabled", "YES", 1 ) but that didn't seem to work.
Proof of concept, needs to be cleaned up. Appears to work as expected,
though:
=====
uint32_t maxLen = 0x400;
char *executablePath = malloc(maxLen);
FSRef fileRef;
NSDictionary *environment = [NSDictionary dictionaryWithObject: @"YES"
forKey: @"NSZombieEnabled"];
assert(!_NSGetExecutablePath(executablePath, &maxLen));
FSPathMakeRef((UInt8 *)executablePath, &fileRef, nil);
LSApplicationParameters appParameters = {0, kLSLaunchDefaults |
kLSLaunchNewInstance, &fileRef, nil, (CFDictionaryRef)environment, nil,
nil};
LSOpenApplication(&appParameters, nil);
[NSApp terminate: nil];
=====
The LS APIs appear to prepend the current environment to whatever you
add to the environment dictionary (above), so it does not appear to be
necessary to add the current environment to that dictionary. But that
doesn't seem to be documented...
_______________________________________________
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