---
title: "LSCanURLAcceptURL(_:_:_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1441854-lscanurlaccepturl
---

# LSCanURLAcceptURL(_:_:_:_:_:)

Tests whether an app can accept (open) an item for a URL.

## Declaration

```swift
func LSCanURLAcceptURL(_ inItemURL: CFURL, _ inTargetURL: CFURL, _ inRoleMask: LSRolesMask, _ inFlags: LSAcceptanceFlags, _ outAcceptsItem: UnsafeMutablePointer<DarwinBoolean>) -> OSStatus
```

## Parameters

- `inItemURL`: A Core Foundation URL reference designating the source item (the item to test for acceptance by the target application); see the CFURL Reference in the Core Foundation Reference Documentation for a description of the CFURLRef data type.
- `inTargetURL`: A Core Foundation URL reference designating the target application; see the CFURL Reference in the Core Foundation Reference Documentation for a description of the CFURLRef data type. The URL must have scheme file and contain a valid path to an application file or application bundle.
- `inRolesMask`: A bit mask specifying the target app’s desired role or roles with respect to the source item; see doc://com.apple.documentation/documentation/coreservices/lsrolesmask for a description of this mask. This parameter applies only to URLs with a scheme component of file, and is ignored for all other schemes. If the role is unimportant, pass kLSRolesAll.
- `inFlags`: Flags specifying behavior to observe during the acceptance test; see doc://com.apple.documentation/documentation/coreservices/lsacceptanceflags for a description of these flags.
- `outAcceptsItem`: A pointer to a Boolean value that, on return, will indicate whether the target application can accept the source item with at least one of the specified roles.

## Return Value

Return Value A result code; see Result Codes.

## Discussion

Discussion If the item URL’s scheme is file (designating either a file or a directory), the acceptance test is based on the designated item’s filename extension, file type, and creator signature, along with the role specified by the inRolesMask parameter; otherwise, it is based on the URL scheme (such as http, ftp, or mailto). Version-Notes Thread-safe since Mac OS version 10.2.

## See Also

### Locating an App

- [LSCopyDefaultApplicationURLForURL(_:_:_:)](coreservices/1448824-lscopydefaultapplicationurlforur.md)
- [LSCopyDefaultApplicationURLForContentType(_:_:_:)](coreservices/1447734-lscopydefaultapplicationurlforco.md)
- [LSCopyApplicationURLsForURL(_:_:)](coreservices/1445148-lscopyapplicationurlsforurl.md)
- [LSCopyApplicationURLsForBundleIdentifier(_:_:)](coreservices/1449290-lscopyapplicationurlsforbundleid.md)
