SMJobBlessXPC icon indicating copy to clipboard operation
SMJobBlessXPC copied to clipboard

Error On Mountain Lion

Open KingOfBrian opened this issue 13 years ago • 12 comments
trafficstars

Not sure what this error is, but on mountain lion, I'm getting:

Failed to bless helper. Error: Error Domain=kSMErrorDomainFramework Code=3 "The operation couldn’t be completed. (kSMErrorDomainFramework error 3 - The client and tool did not match requirements.)" UserInfo=0x1001577b0 {NSDescription=The client and tool did not match requirements.}

KingOfBrian avatar Jun 13 '12 01:06 KingOfBrian

I got the XPC part working without privilege escalation by using SMJobSubmit instead of Bless. I realize that this is different than the purpose of this demo app, but it's all I need - XPC Between my background menu item and forground viewer.

- (BOOL)startUserAgentWithLabel:(NSString *)label
                          error:(NSError **)error
{    
    CFDictionaryRef job = SMJobCopyDictionary(kSMDomainUserLaunchd, (CFStringRef)label);
    NSLog(@"Job = %@", (NSDictionary *)job);
    if (job == NULL)
    {
        NSMutableDictionary *plist = [NSMutableDictionary dictionary];
        [plist setObject:@"com.apple.bsd.SMJobBlessHelper" forKey:@"Label"];
        [plist setObject:@"com.apple.bsd.SMJobBlessHelper" forKey:@"Program"];
        [plist setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO]
                                                    forKey:@"com.apple.bsd.SMJobBlessHelper"]
                  forKey:@"MachServices"];

        BOOL ok = SMJobSubmit(kSMDomainUserLaunchd, (CFDictionaryRef)plist, NULL, (CFErrorRef *)error);

        return ok;
    }
    return YES;

}

KingOfBrian avatar Jun 13 '12 02:06 KingOfBrian

Actually, I retract that. It got a bit farther but was complaining:

Helper available. Sending request: Hi there, helper service. XPC connection invalid, releasing. Received response: (null).

If I wasn't half asleep, I would of noticed ;)

KingOfBrian avatar Jun 13 '12 04:06 KingOfBrian

Did you ever figure out the original problem? I got the same exact error myself..

davidsielert avatar Nov 28 '12 02:11 davidsielert

Noticed in ASL 11/27/12 6:20:03.581 PM launchdadd[56637]: FAILURE: Code <SecCode 0x7fc0e31005e0 [0x7fff7bed5fd0]> failed requirement (identifier "com.apple.bsd.SMJobBlessApp" and certificate leaf[subject.CN] = "Mac Developer: Nathan de Vries (T3RB9JQ8KZ)") with error "The operation couldn’t be completed. (OSStatus error -67050.)" 11/27/12 6:20:03.581 PM launchdadd[56637]: FAILURE: Code <SecStaticCode 0x7fc0e3600870 [0x7fff7bed5fd0]> failed requirement (identifier "com.apple.bsd.SMJobBlessHelper" and certificate leaf[subject.CN] = "Mac Developer: Nathan de Vries (T3RB9JQ8KZ)") with error "The operation couldn’t be completed. (OSStatus error -67050.)" 11/27/12 6:20:03.582 PM launchdadd[56637]: FAILURE: Job com.apple.bsd.SMJobBlessHelper could not be installed from /Users/david/Library/Developer/Xcode/DerivedData/SMJobBless-eatewdvwqlbljaakruwdobjxswkj/Build/Products/Debug/SMJobBlessApp.app/Contents/Library/LaunchServices/com.apple.bsd.SMJobBlessHelper, reason 3.

davidsielert avatar Nov 28 '12 02:11 davidsielert

OK I figured this out .. You have to change the Identity in the info.plist's (as Nathan Says) and also in the build settings.. Nathan Signed with his appstore certificate which we of course do not have so it will not work

davidsielert avatar Nov 28 '12 02:11 davidsielert

I changed my identity in both plist files, the one for the app and the one for the helper, and I also changed the code signing identitys in each project. I still get the error:

Failed to bless helper. Error: Error Domain=kSMErrorDomainFramework Code=3 "The operation couldn’t be completed. (kSMErrorDomainFramework error 3 - The client and tool did not match requirements.)" UserInfo=0x101d20130 {NSDescription=The client and tool did not match requirements.}

Any ideas why it might not be working for me?

socketwiz avatar Dec 24 '12 15:12 socketwiz

I can't explain why, but this started working for me when I tried to reproduce the problem so I could post another question on StackOverflow. It could be that I moved the project to another directory and did a clean build. I'm not sure. All I know is not only is this project working for me, but I've been able to also replicate in a project of my own.

socketwiz avatar Jan 11 '13 02:01 socketwiz

A Product -> Clean (shift+cmd+k) may help ;)

mmichaa avatar Mar 15 '13 18:03 mmichaa

Is a Mac Developer profile sufficient for this, or must it be an App Store profile?

wookiee avatar May 03 '13 15:05 wookiee

Mac developer will work

On May 3, 2013, at 8:29 AM, "Michael L. Ward" [email protected] wrote:

Is a Mac Developer profile sufficient for this, or must it be an App Store profile?

— Reply to this email directly or view it on GitHub.

davidsielert avatar May 03 '13 15:05 davidsielert

A self-signing certificate suffices. Take a look at: https://developer.apple.com/library/mac/#documentation/security/Conceptual/CodeSigningGuide/Procedures/Procedures.html -- "To use the Certificate Assistant to create a self-signed signing identity"

mmichaa avatar May 03 '13 15:05 mmichaa

Use Developer ID signatures.. apple changed their SMJobBless Samplecode to reflect this based on my DTS response/request

Developer ID will allow the app to run without GateKeeper complaining about an unknown developer...

RudyAramayo avatar May 03 '13 15:05 RudyAramayo