<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/sel_getUid(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:@F@sel_getUid"
  },
  "title" : "sel_getUid(_:)"
}
-->

# sel_getUid(_:)

Registers a method name with the Objective-C runtime system.

```
func sel_getUid(_ str: UnsafePointer<CChar>) -> Selector
```

## Parameters

`str`

A pointer to a C string. Pass the name of the method you wish to register.

## Return Value

A pointer of type [`SEL`](/documentation/ObjectiveC/SEL) specifying the selector for the named method.

## Discussion

The implementation of this method is identical to the implementation of [`sel_registerName(_:)`](/documentation/ObjectiveC/sel_registerName(_:)).

### Version-Notes

Prior to OS X version 10.0, this method tried to find the selector mapped to the given name and returned `NULL` if the selector was not found. This was changed for safety, because it was observed that many of the callers of this function did not check the return value for `NULL`.

---

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)