Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective C Deamon not start
    primarykey
    data
    text
    <p>i have developed a Deamon that run at start of Mac, this deamon run correctly until i have install a new OSX 10.8.5 [this deamon run correctly for 10.8.4].</p> <p>i don't know where is my error,</p> <p>i have create a Terminal app that write a dictionary like this:</p> <pre><code>KeepAlive = 1; Label = "vetrya.ControlloPresenza"; MachServices = { "vetrya.ControlloPresenza" = 1; }; Program = "/System/Library/VetryaControllo/ControlloPresenza"; ProgramArguments = start; RunAtLoad = 1; StartInterval = 20; inetdCompatibility = { Wait = 0; }; </code></pre> <p>an then write this dict inside this Dir: /System/Library/LaunchDaemons/</p> <p>but now this precess not start, anyone know the reason of this?</p> <p>this how i write dict of and the result of plist war write correctly</p> <pre><code>NSMutableArray* arrayArguments = [[NSMutableArray alloc] initWithCapacity:1]; [arrayArguments addObject:@"/System/Library/VetryaControllo/ControlloPresenza"]; [arrayArguments addObject:@"start"]; NSDictionary* dict = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:NO],@"Wait", nil]; NSDictionary* dictNew = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES],@"vetrya.ControlloPresenza", nil]; [self.controlloPresenza setObject:@"vetrya.ControlloPresenza" forKey:@"Label"]; [self.controlloPresenza setObject:@"/System/Library/VetryaControllo/ControlloPresenza" forKey:@"Program"]; [self.controlloPresenza setObject:@"start" forKey:@"ProgramArguments"]; [self.controlloPresenza setObject:dict forKey:@"inetdCompatibility"]; [self.controlloPresenza setObject:dictNew forKey:@"MachServices"]; [self.controlloPresenza setObject:[NSNumber numberWithBool:YES] forKey:@"KeepAlive"]; [self.controlloPresenza setObject:[NSNumber numberWithBool:YES] forKey:@"RunAtLoad"]; [self.controlloPresenza setObject:[NSNumber numberWithInt:20] forKey:@"StartInterval"]; </code></pre> <p>i have make some change now the plist is follow:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;KeepAlive&lt;/key&gt; &lt;true/&gt; &lt;key&gt;Label&lt;/key&gt; &lt;string&gt;vetrya.ControlloPresenza&lt;/string&gt; &lt;key&gt;MachServices&lt;/key&gt; &lt;dict&gt; &lt;key&gt;vetrya.ControlloPresenza&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;key&gt;Program&lt;/key&gt; &lt;string&gt;/System/Library/VetryaControllo/ControlloPresenza&lt;/string&gt; &lt;key&gt;ProgramArguments&lt;/key&gt; &lt;string&gt;start&lt;/string&gt; &lt;key&gt;RunAtLoad&lt;/key&gt; &lt;true/&gt; &lt;key&gt;StartInterval&lt;/key&gt; &lt;integer&gt;20&lt;/integer&gt; &lt;key&gt;inetdCompatibility&lt;/key&gt; &lt;dict&gt; &lt;key&gt;Wait&lt;/key&gt; &lt;false/&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre> <p>i have found on line that to register the Daemon to next reboot i can use this Terminal comand:</p> <pre><code>sudo chown root:wheel &lt;name.plist&gt; sudo chmod 644 &lt;name.plist&gt; </code></pre> <p>but when i create the NSTask like this:</p> <pre><code> NSTask *task; task = [[NSTask alloc] init]; [task setLaunchPath:_registrationPath]; [task setArguments: @[@"sudo", @"chown",@"root:wheel",@"vetrya.ControlloPresenza.plist"]]; NSPipe *pipe; pipe = [NSPipe pipe]; [task setStandardOutput: pipe]; NSFileHandle *file; file = [pipe fileHandleForReading]; [task launch]; [task waitUntilExit]; task = [[NSTask alloc] init]; [task setLaunchPath:_registrationPath]; [task setArguments: @[@"sudo", @"chmod",@"644",@"vetrya.ControlloPresenza.plist"]]; pipe = [NSPipe pipe]; [task setStandardOutput: pipe]; file = [pipe fileHandleForReading]; [task launch]; [task waitUntilExit]; </code></pre> <p>but at the end i have this error: failed: 22, "Invalid argument". how i have to write this comand?</p> <p>Regards</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload