I may have spoken too soon -- it worked for me on macOS [15.7.3] but a co-worker reports it's still returning BadReference on iOS [26?]. From my logging I can see that the arguments passed in this specific failing call are as follows:
vector<uint8_t> record = encodeDNS("multipeer-todo-0F2BDA36._couchbaseP2P._tcp,com\\.couchbase\\.multipeer\\.todo.local.");
err = DNSServiceReconfirmRecord(
0, // flags
15, // interface; this is what was reported by service discovery
"_couchbaseP2P._tcp,com\.couchbase\\.multipeer\\.todo.local.", // fullname
kDNSServiceType_PTR,
kDNSServiceClass_IN,
record.size(), record.data() );
where encodeDNS is a function I wrote to generate an encoded DNS record, which has unit tests to verify it correctly handles escape sequences.
Note we're using a service subtype. I was worried this might require special handling, but at least on macOS it didn't. Perhaps that's different on iOS?
The kDNSServiceErr_BadReference error is odd in that the function doesn't take a service reference.