Hi folks,
I’m looking to move some of the keychain interaction of a project I maintain (https://github.com/macmule/ADPassMon) from using the security binary to the Keychain Services API (https://developer.apple.com/library/prerelease/mac/documentation/Security/Reference/keychainservices/#//apple_ref/doc/uid/TP30000898-CH1g-286517).
But I’m struggling to figure out how best to add/call the API from my ADPassMon.
I’ve added the framework the to app in Xcode in a test project, which main.m looks like:
#import <Cocoa/Cocoa.h>
#import <AppleScriptObjC/AppleScriptObjC.h>
#import <Security/SecKeychain.h>
int main(int argc, const char * argv[]) {
[[NSBundle mainBundle] loadAppleScriptObjectiveCScripts];
return NSApplicationMain(argc, argv);
}
I’ve then tried to declare a property as per, the below in the AppDelegate:
script AppDelegate
property parent : class "NSObject"
property SecKeychain : class "SecKeychain"
property defaultKeychain : ""
-- IBOutlets
property theWindow : missing value
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
set keychain_status to SecKeychain's SecKeychainGetVersion
log keychain_status
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
But, I’m getting the below with the above:
*** -[AppDelegate applicationWillFinishLaunching:]: Can't get SecKeychainGetVersion of class "SecKeychain". (error -1728)
Help appreciated!