How to change displayName for a Replicated File Provider extension domain on macOS?

I'm working on a Replicated File Provider extension for macOS. I've come across an issue recently on macOS 13+. It seems that the displayName of the domain changes when I call addDomain multiple times with the same NSFileProviderDomainIdentifier but with different displayName parameters.

This behavior seems correct so far.

However, the displayName, and of course the actual path under CloudStorage, revert back to their original values when I call disconnect to a domain manager.

Here's the code snippet of getting existing doamin and disconnecting it:

    NSFileProviderManager.getDomainsWithCompletionHandler() { domainList, error in
    defer { dispatchGroup.leave() }

    for domain in domainList {
        if domain.identifier == NSFileProviderDomainIdentifier(rawValue: String(sessionId)){
            domainResult = domain
            break
        }
    }
}

dispatchGroup.wait()

guard let manager = NSFileProviderManager(for: domainResult) else {
    return -1
}

manager.disconnect(reason: disconnectReason, options: []) { error in
    defer {
        dispatchGroup.leave()
    }

    errorResult = error
}

dispatchGroup.wait()

Could a member of the internal team please help confirm if this is the correct method for updating the displayName of an existing domain?

Additionally, is there a way to ensure that the new displayName persists even after disconnecting it?

It would be great to allow users to customize and set a meaningful name for it.

Thanks.

Min

How to change displayName for a Replicated File Provider extension domain on macOS?
 
 
Q