<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "IOBluetooth",
  "identifier" : "/documentation/IOBluetooth/IOBluetoothSDPServiceAttribute/withID(_:attributeElement:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "IOBluetooth"
    ],
    "preciseIdentifier" : "c:objc(cs)IOBluetoothSDPServiceAttribute(cm)withID:attributeElement:"
  },
  "title" : "withID(_:attributeElement:)"
}
-->

# withID(_:attributeElement:)

Creates a new service attribute with the given ID and data element.

```
class func withID(_ newAttributeID: BluetoothSDPServiceAttributeID, attributeElement: IOBluetoothSDPDataElement!) -> Self!
```

## Parameters

`newAttributeID`

The attribute ID of the new service attribute.

`attributeElement`

The data element of the new service attribute.

## Return Value

Returns the newly allocated service attribute object. Returns nil if there was an error. The returned IOBluetoothSDPDataElement object has been autoreleased, so it is not necessary for the caller to release it. If the object is to be referenced and kept around, retain should be called.

## Discussion

---

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)