Skip to content

Instantly share code, notes, and snippets.

@rentzsch
Created November 9, 2009 07:27
Show Gist options
  • Save rentzsch/229760 to your computer and use it in GitHub Desktop.
Save rentzsch/229760 to your computer and use it in GitHub Desktop.
NSAppleEventDescriptor *target = [NSAppleEventDescriptor descriptorWithDescriptorType:typeApplicationBundleID
data:[@"com.apple.Finder" dataUsingEncoding:NSUTF8StringEncoding]];
NSAppleEventDescriptor *quitEvent = [NSAppleEventDescriptor appleEventWithEventClass:kCoreEventClass
eventID:kAEQuitApplication
targetDescriptor:target
returnID:kAutoGenerateReturnID
transactionID:kAnyTransactionID];
OSStatus err = AESendMessage([quitEvent aeDesc], // theAppleEvent
NULL, // reply
kAENoReply, // sendMode
0); // sendPriority
NSAssert1( err == noErr, @"AESendMessage failed: %d", err );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment