You can try using the static analyser to solve issues like this CMD+Shift+B
is the default shortcut
But you're mixing your bridges up
NSData* SAKeychainGetValue(NSString *key)
{
NSMutableDictionary *searchDictionary = SAGetKeychainSearchDictionary(key);
[searchDictionary setObject:(__bridge id)kSecMatchLimitOne forKey:(__bridge id)kSecMatchLimit];
[searchDictionary setObject:(id)kCFBooleanTrue forKey:(__bridge id)kSecReturnData];
CFDataRef value = nil;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)searchDictionary, (CFTypeRef *)&value);
if (status != errSecSuccess && status != errSecItemNotFound)
{
NSLog(@"failed to get key %@ with error %ld.", key, (long)status);
}
return (__bridge_transfer NSData*)value;
}
You could also probably just use NSData
directly:
NSData *value = nil;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)searchDictionary, (CFTypeRef *)&value);
...
return value;