Created
September 25, 2009 08:59
-
-
Save floehopper/193417 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SecAccessRef createAccess(NSString *accessLabel) | |
{ | |
OSStatus err; | |
SecAccessRef access=nil; | |
NSArray *trustedApplications=nil; | |
//Make an exception list of trusted applications; that is, | |
// applications that are allowed to access the item without | |
// requiring user confirmation: | |
SecTrustedApplicationRef myself, someOther; | |
//Create trusted application references; see SecTrustedApplications.h: | |
err = SecTrustedApplicationCreateFromPath(NULL, &myself); | |
err = SecTrustedApplicationCreateFromPath("/Applications/Mail.app", | |
&someOther); | |
trustedApplications = [NSArray arrayWithObjects:(id)myself, | |
(id)someOther, nil]; | |
//Create an access object: | |
err = SecAccessCreate((CFStringRef)accessLabel, | |
(CFArrayRef)trustedApplications, &access); | |
if (err) return nil; | |
return access; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment