iPhone SDK: Bonjour & NSNetService name != published name?
- by Harkonian
In my iPhone app, I'm publishing a bonjour service and using the following delegate method:
- (void)netServiceDidPublish:(NSNetService *)ns
{
NSLog(@"Bonjour Service Published: http://%@.%@", [ns name], [ns domain]);
}
The "name" property is returning the device name, "How's Testing", which is correct. However, when I use Safari to discover available services the name is "hows-testing" -- the service is http://hows-testing.local.:.
Why is the published name different than what is being reported by the NSNetService? How do I display for the actual name of the published service? Assuming that, for some reason, there is no way to get the published name from the object, how do I determine it myself? I understand that it's based on device name, but what are the substitution rules? Remove apostrophes, replace spaces with dash...anything else? What about special characters?