<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFURLCopyResourcePropertyForKey(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFURLCopyResourcePropertyForKey"
  },
  "title" : "CFURLCopyResourcePropertyForKey(_:_:_:_:)"
}
-->

# CFURLCopyResourcePropertyForKey(_:_:_:_:)

Returns the value of a given resource property of a given URL.

```
func CFURLCopyResourcePropertyForKey(_ url: CFURL!, _ key: CFString!, _ propertyValueTypeRefPtr: UnsafeMutableRawPointer!, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>!) -> Bool
```

## Parameters

`url`

The URL.

`key`

The property value key for the requested value.

`propertyValueTypeRefPtr`

The output pointer that is populated with the result.

`error`

The error that occurred if the property’s value could not be obtained. This parameter is optional. If you are not interested in receiving error information, you can pass `NULL`.

## Return Value

`true` if `propertyValueTypeRefPtr` is successfully populated; otherwise, `false`.

## Discussion

This function first checks if the URL object already caches the resource value. If so, it returns the cached resource value to the caller. If not, then this function synchronously obtains the resource value from the backing store, adds the resource value to the URL object’s cache, and returns the resource value to the caller.

The type of the returned resource value varies by resource property; for details, see the documentation for the key you want to access.

If this function returns <doc://com.apple.documentation/documentation/Swift/true> and the propertyValueTypeRefPtr is populated with `nil`, it means that the resource property is not available for the specified resource, and that no errors occurred when determining that the resource property was unavailable.

If this function returns <doc://com.apple.documentation/documentation/Swift/false>, an error occurred. the object pointer referenced by `error` is populated with additional information.

> Note:
> This method applies only to URLs that represent file system resources.

## See Also

[`CFURL`](/documentation/CoreFoundation/CFURL)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)