The result data type is just CFTypeRef until the SecItemCopyMatching call begins, passing to CFTypeRef :
CFTypeRef resultData = nil; status = SecItemCopyMatching((__bridge CFDictionaryRef) passwordQuery, &resultData);
Since the request indicated that resultData should be CFDataRef , resultData now CFDataRef , and now you can use it as such. then add it further to NSData .
CFDataRef resultCFData = (CFDataRef)resultData; NSData *resultNSData = (__bridge NSData *)resultCFData;
Or in one line:
NSData *resultNSData = (__bridge NSData *)(CFDataRef)resultData;
source share