2
在MacRuby Pointer to typedef struct提领的时候,我学会了如何与非关联MacRuby的指针,参考,使用Cocoa框架
x=Pointer.new_with_type
...
==> use x.value, or x[0]
创建的指针作品一种享受!
现在我想了解我认为是“相反”的东西。我正在尝试使用此API。
OSStatus SecKeychainCopySettings (
SecKeychainRef keychain,
SecKeychainSettings *outSettings
);
第二个参数必须是指针。但我从来没有设法打开钥匙串的真正outSettings,我只获得默认设置。
framework 'Security'
keychainObject = Pointer.new_with_type('^{OpaqueSecKeychainRef}')
SecKeychainOpen("/Users/charbon/Library/Keychains/Josja.keychain",keychainObject)
#attempt #1
settings=Pointer.new_with_type('{SecKeychainSettings=IBBI}')
SecKeychainCopySettings(keychainObject.value, settings)
p settings.value
#<SecKeychainSettings version=0 lockOnSleep=false useLockInterval=false lockInterval=0>
#attempt #2
settings2=SecKeychainSettings.new
result = SecKeychainCopySettings(keychainObject.value, settings2)
p settings2
#<SecKeychainSettings version=0 lockOnSleep=false useLockInterval=false lockInterval=0>
钥匙串的设置应打开阅读
#<SecKeychainSettings version=0 lockOnSleep=true useLockInterval=true lockInterval=1800>
我缺少什么?