---
title: "LSSetDefaultHandlerForURLScheme(_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1447760-lssetdefaulthandlerforurlscheme
---

# LSSetDefaultHandlerForURLScheme(_:_:)

Sets the user’s preferred default handler for the specified URL scheme.

## Declaration

```swift
func LSSetDefaultHandlerForURLScheme(_ inURLScheme: CFString, _ inHandlerBundleID: CFString) -> OSStatus
```

## Parameters

- `inURLScheme`: The URL scheme for which the handler is to be set.
- `inHandlerBundleID`: The bundle identifier that is to be set as the handler for the URL scheme specified by inURLScheme.

## Return Value

Return Value A result code; see Result Codes.

## Discussion

Discussion Call LSCopyDefaultHandlerForURLScheme(_:) to get the current setting of the user’s preferred default handler for a specified content type. URL handling capability is determined according to the value of the CFBundleURLTypes key in an app’s Info.plist. For information on the CFBundleURLTypes key, see the section “CFBundleURLTypes” in macOS Runtime Configuration Guidelines. Version-Notes Thread-safe since OS X v10.4.

## See Also

### Working with Role Handlers

- [LSCopyAllRoleHandlersForContentType(_:_:)](coreservices/1448020-lscopyallrolehandlersforcontentt.md)
- [LSCopyDefaultRoleHandlerForContentType(_:_:)](coreservices/1449868-lscopydefaultrolehandlerforconte.md)
- [LSSetDefaultRoleHandlerForContentType(_:_:_:)](coreservices/1444955-lssetdefaultrolehandlerforconten.md)
- [LSRolesMask](coreservices/lsrolesmask.md)
