---
title: "DNSServiceUpdateRecord(_:_:_:_:_:_:)"
framework: dnssd
role: symbol
role_heading: Function
path: "dnssd/dnsserviceupdaterecord(_:_:_:_:_:_:)"
---

# DNSServiceUpdateRecord(_:_:_:_:_:_:)

Updates a registered resource record.

## Declaration

```swift
func DNSServiceUpdateRecord(_ sdRef: DNSServiceRef!, _ recordRef: DNSRecordRef!, _ flags: DNSServiceFlags, _ rdlen: UInt16, _ rdata: UnsafeRawPointer!, _ ttl: UInt32) -> DNSServiceErrorType
```

## Parameters

- `sdRef`: A DNSServiceRef that was initialized by doc://com.apple.dnssd/documentation/dnssd/DNSServiceRegister(_:_:_:_:_:_:_:_:_:_:_:_:) or doc://com.apple.dnssd/documentation/dnssd/DNSServiceCreateConnection(_:).
- `recordRef`: A DNSRecordRef initialized by doc://com.apple.dnssd/documentation/dnssd/DNSServiceAddRecord(_:_:_:_:_:_:_:), or NULL to update the service’s primary txt record.
- `flags`: Currently ignored, reserved for future use.
- `rdlen`: The length, in bytes, of the new rdata.
- `rdata`: The new rdata to be contained in the updated resource record.
- `ttl`: The time to live of the updated resource record, in seconds. Most clients should pass 0 to indicate that the system should select a sensible default value.

## Return Value

Return Value Returns kDNSServiceErr_NoError on success, otherwise returns an error code indicating the error that occurred.

## Discussion

Discussion The record must either be: The primary txt record of a service registered via DNSServiceRegister(_:_:_:_:_:_:_:_:_:_:_:_:) A record added to a registered service via DNSServiceAddRecord(_:_:_:_:_:_:_:) An individual record registered by DNSServiceRegisterRecord(_:_:_:_:_:_:_:_:_:_:_:_:)

## See Also

### Service Registration

- [DNSServiceAddRecord(_:_:_:_:_:_:_:)](dnssd/dnsserviceaddrecord(_:_:_:_:_:_:_:).md)
- [DNSServiceRegister(_:_:_:_:_:_:_:_:_:_:_:_:)](dnssd/dnsserviceregister(_:_:_:_:_:_:_:_:_:_:_:_:).md)
- [DNSServiceRemoveRecord(_:_:_:)](dnssd/dnsserviceremoverecord(_:_:_:).md)
