Example #1
0
CFStringRef CFErrorCopyFailureReason(CFErrorRef err) {
    if (CF_IS_OBJC(__kCFErrorTypeID, err)) {  // Since we have to return a retained result, we need to treat the toll-free bridging specially
        CFStringRef str;
        CF_OBJC_CALL0(CFStringRef, str, err, "localizedFailureReason");
        return str ? (CFStringRef)CFRetain(str) : NULL;    // It's possible for localizedFailureReason to return nil
    }
    __CFAssertIsError(err);
    return _CFErrorCreateLocalizedFailureReason(err);
}
Example #2
0
CFStringRef CFErrorCopyFailureReason(CFErrorRef err) {
    if (CF_IS_OBJC(err)) {
        // Since we have to return a retained result, 
        //  we need to treat the toll-free bridging specially.
        CFStringRef str;
        CF_OBJC_CALL(CFStringRef, str, err, "localizedFailureReason");
        // It's possible for localizedFailureReason to return nil.
        return str ? (CFStringRef)CFRetain(str) : NULL;
    }
    CF_VALIDATE_ERROR_ARG(err);
    return _CFErrorCreateLocalizedFailureReason(err);
}