カスタムキーチェーンに保存されているパスワードを取得するために使用しているコードの一部に続いて
-(OSStatus *)getPasswordFromKeyChain:(NSString *)username{
OSStatus status;
[self createKeyChainIfNotExists];
const char *cService_name = "Mac Google Analytics App";
UInt32 service_length = strlen(cService_name);
const char *cUser_name = [username cStringUsingEncoding:NSUTF8StringEncoding];
UInt32 username_length = strlen(cUser_name);
void *passwordData = nil;
SecKeychainItemRef itemRef = nil;
UInt32 passwordLength = nil;
status = SecKeychainFindGenericPassword(
mSecKeychainRef, // default keychain
service_length, // length of service name
cService_name, // service name
username_length,// length of account name
cUser_name, // account name
&passwordLength, // length of password
passwordData, // pointer to password data
NULL // the item reference
);
return status;
}
この呼び出しからは決して出てこないので、このコードの何が問題になっているのだろうか。
SecKeychainFindGenericPassword
ここに示されているエラーを示しています。