---
title: "CFURLCreateAbsoluteURLWithBytes(_:_:_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfurlcreateabsoluteurlwithbytes(_:_:_:_:_:_:)"
---

# CFURLCreateAbsoluteURLWithBytes(_:_:_:_:_:_:)

Creates a new CFURL object by resolving the relative portion of a URL, specified as bytes, against its given base URL.

## Declaration

```swift
func CFURLCreateAbsoluteURLWithBytes(_ alloc: CFAllocator!, _ relativeURLBytes: UnsafePointer<UInt8>!, _ length: CFIndex, _ encoding: CFStringEncoding, _ baseURL: CFURL!, _ useCompatibilityMode: Bool) -> CFURL!
```

## Parameters

- `alloc`: The allocator to use to allocate memory for the new CFURL object. Pass NULL or doc://com.apple.corefoundation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `relativeURLBytes`: The character bytes that represent a relative URL to convert into a CFURL object.
- `length`: The number of bytes in relativeURLBytes.
- `encoding`: The string encoding of the relativeURLBytes string. This encoding is also used to interpret percent escape sequences.
- `baseURL`: The URL to which relativeURLBytes is relative.
- `useCompatibilityMode`: If true, the rules historically used on the web are used to resolve the string specified by the relativeURLBytes parameter against baseURL. These rules are generally listed in the RFC as optional or alternate interpretations. Otherwise, the strict rules from the RFC are used.

## Return Value

Return Value A new CFURL object, or NULL if relativeURLBytes cannot be made absolute. Ownership follows the create rule. See The Create Rule.

## Discussion

Discussion This function interprets the provided bytes using the specified string encoding to create the relative portion of the URL’s address. note: This function does not support string encoding which isn’t a superset of ASCII encoding. Both CFURLGetBytes(_:_:_:) and CFURLGetByteRangeForComponent(_:_:_:) require 7-bit ASCII characters to be stored in a single 8-bit byte. The following CFStringEncodings can be used: CFStringBuiltInEncodings.macRoman, CFStringBuiltInEncodings.windowsLatin1, CFStringBuiltInEncodings.isoLatin1, CFStringBuiltInEncodings.nextStepLatin, CFStringBuiltInEncodings.ASCII and CFStringBuiltInEncodings.UTF8.

## See Also

### Creating a CFURL

- [CFURLCopyAbsoluteURL(_:)](corefoundation/cfurlcopyabsoluteurl(_:).md)
- [CFURLCreateByResolvingBookmarkData(_:_:_:_:_:_:_:)](corefoundation/cfurlcreatebyresolvingbookmarkdata(_:_:_:_:_:_:_:).md)
- [CFURLCreateCopyAppendingPathComponent(_:_:_:_:)](corefoundation/cfurlcreatecopyappendingpathcomponent(_:_:_:_:).md)
- [CFURLCreateCopyAppendingPathExtension(_:_:_:)](corefoundation/cfurlcreatecopyappendingpathextension(_:_:_:).md)
- [CFURLCreateCopyDeletingLastPathComponent(_:_:)](corefoundation/cfurlcreatecopydeletinglastpathcomponent(_:_:).md)
- [CFURLCreateCopyDeletingPathExtension(_:_:)](corefoundation/cfurlcreatecopydeletingpathextension(_:_:).md)
- [CFURLCreateFilePathURL(_:_:_:)](corefoundation/cfurlcreatefilepathurl(_:_:_:).md)
- [CFURLCreateFileReferenceURL(_:_:_:)](corefoundation/cfurlcreatefilereferenceurl(_:_:_:).md)
- [CFURLCreateFromFileSystemRepresentation(_:_:_:_:)](corefoundation/cfurlcreatefromfilesystemrepresentation(_:_:_:_:).md)
- [CFURLCreateFromFileSystemRepresentationRelativeToBase(_:_:_:_:_:)](corefoundation/cfurlcreatefromfilesystemrepresentationrelativetobase(_:_:_:_:_:).md)
- [CFURLCreateFromFSRef(_:_:)](corefoundation/cfurlcreatefromfsref(_:_:).md)
- [CFURLCreateWithBytes(_:_:_:_:_:)](corefoundation/cfurlcreatewithbytes(_:_:_:_:_:).md)
- [CFURLCreateWithFileSystemPath(_:_:_:_:)](corefoundation/cfurlcreatewithfilesystempath(_:_:_:_:).md)
- [CFURLCreateWithFileSystemPathRelativeToBase(_:_:_:_:_:)](corefoundation/cfurlcreatewithfilesystempathrelativetobase(_:_:_:_:_:).md)
- [CFURLCreateWithString(_:_:_:)](corefoundation/cfurlcreatewithstring(_:_:_:).md)
