<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSURL/init(resolvingAliasFileAt:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURL(cm)URLByResolvingAliasFileAtURL:options:error:"
  },
  "title" : "init(resolvingAliasFileAt:options:)"
}
-->

# init(resolvingAliasFileAt:options:)

Returns a new URL made by resolving the alias file at `url`.

```
convenience init(resolvingAliasFileAt url: URL, options: NSURL.BookmarkResolutionOptions = []) throws
```

## Parameters

`url`

The URL pointing to the alias file.

`options`

Options taken into account when resolving the bookmark data. The [`withSecurityScope`](/documentation/Foundation/NSURL/BookmarkResolutionOptions/withSecurityScope) option is not supported by this method.

## Return Value

A new URL created by resolving the bookmark data derived from the provided alias file. If an error occurs, this method returns `nil`.

## Discussion

Creates and initializes a new URL based on the alias file at `url`. Use this method to resolve bookmark data that was saved using [`writeBookmarkData(_:to:options:)`](/documentation/Foundation/NSURL/writeBookmarkData(_:to:options:)) and resolves that data in one step.

If the `url` argument does not refer to an alias file as defined by the `NSURLIsAliasFileKey` property, this method returns the `url` argument.

If the `url` argument is unreachable, this method returns `nil` and the optional error argument is populated.

> Handling Errors in Swift:
> In Swift, this method returns a nonoptional result and is marked with the `throws` keyword to indicate that it throws an error in cases of failure.
> 
> You call this method in a `try` expression and handle any errors in the `catch` clauses of a `do` statement, as described in [Error Handling](https://docs.swift.org/swift-book/LanguageGuide/ErrorHandling.html) in [The Swift Programming Language](https://docs.swift.org/swift-book/) and `About Imported Cocoa Error Parameters`.

---

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)