I have noticed a difference in the behavior of a unit test
(SenTestCase) when it is run in Release mode against the i386 arch and
the ppc arch in Xcode 3.0 on Leopard.
The following code correctly populates the SecKeychainAttributeList
"list" for i386. This exact same code, when run from the exact same
unit test fails with "errSecAuthFailed" (code -25293) for ppc:
SecKeychainItemRef item;
NSString *serviceName = @"MyService";
OSStatus status = SecKeychainFindGenericPassword(NULL,
[serviceName
length],
[serviceName
UTF8String],
0,
NULL,
NULL,
NULL,
&item);
if (status != noErr) {
return nil; // status is always 0. always works up to this
point.
}
// from Advanced Mac OS X Programming, ch. 16
UInt32 length;
char *password;
SecKeychainAttribute attributes[8];
SecKeychainAttributeList list;
attributes[0].tag = kSecAccountItemAttr;
attributes[1].tag = kSecDescriptionItemAttr;
attributes[2].tag = kSecLabelItemAttr;
attributes[3].tag = kSecModDateItemAttr;
list.count = 4;
list.attr = attributes;
// status is always 0 on i386, -25293 on ppc
status = SecKeychainItemCopyContent(item, NULL, &list, &length,
(void **)&password);
Does anyone have ideas about the source of this difference?