---
title: "CFURLCreateDataAndPropertiesFromResource(_:_:_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfurlcreatedataandpropertiesfromresource(_:_:_:_:_:_:)"
---

# CFURLCreateDataAndPropertiesFromResource(_:_:_:_:_:_:)

Loads the data and properties referred to by a given URL.

## Declaration

```swift
func CFURLCreateDataAndPropertiesFromResource(_ alloc: CFAllocator!, _ url: CFURL!, _ resourceData: UnsafeMutablePointer<Unmanaged<CFData>?>!, _ properties: UnsafeMutablePointer<Unmanaged<CFDictionary>?>!, _ desiredProperties: CFArray!, _ errorCode: UnsafeMutablePointer<Int32>!) -> Bool
```

## Parameters

- `alloc`: The allocator to use to allocate memory for the new CFData and CFDictionary objects returned in resourceData and properties. Pass NULL or kCFAllocatorDefault to use the current default allocator.
- `url`: The URL referring to the data and/or properties you wish to load.
- `resourceData`: On return, contains a CFData object containing the data referred to by url. Ownership follows the https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029.
- `properties`: On return, a pointer to a CFDictionary object containing the resource properties referred to by url. Ownership follows the https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029.
- `desiredProperties`: A list of the properties you wish to obtain and return in properties. See doc://com.apple.corefoundation/documentation/CoreFoundation/file-url-properties and doc://com.apple.corefoundation/documentation/CoreFoundation/http-url-properties for the list of available properties.
- `errorCode`: 0 if successful, otherwise an error code indicating the nature of the problem. See doc://com.apple.corefoundation/documentation/CoreFoundation/CFURLError for a list of possible error codes.

## Return Value

Return Value true if successful, false otherwise.

## Discussion

Discussion If you are interested in loading only the resource data or the resource’s properties, pass NULL for the one you don’t want. If properties is non-NULL and desiredProperties is NULL then all properties are fetched. Note that as much work as possible is done even if false is returned. For instance, if one property is not available, the others are fetched anyway. This function is intended for convenience, not performance.

## See Also

### Core Foundation URL Access Utilities Miscellaneous Functions

- [CFURLCreatePropertyFromResource(_:_:_:_:)](corefoundation/cfurlcreatepropertyfromresource(_:_:_:_:).md)
- [CFURLDestroyResource(_:_:)](corefoundation/cfurldestroyresource(_:_:).md)
- [CFURLWriteDataAndPropertiesToResource(_:_:_:_:)](corefoundation/cfurlwritedataandpropertiestoresource(_:_:_:_:).md)
