I have an iOS app that publishes a Bonjour service. On my network, the Mac app recognizes the service and everything runs smoothly. On some networks however, the Bonjour service is not "seen" by the Mac. I can't reproduce this on my own network. I have had users check for the service using Bonjour Browser and it's not found. Is there a way to diagnose this problem further? I thought it might be a firewall / router issue but some users have very simple Apple-based networks (Airport). Any ideas on what could be causing this?
3 Answers
Have you tried implementing the
- (void)netService:(NSNetService *)sender didNotPublish:(NSDictionary *)errorDict
method? it can occasionally provide useful information although I have found the NSNetService to have strange behaviour sometimes also. Stopping the NSNetService and re-publishing is an ugly option which seemed to work for me to some extent.

- 16,757
- 4
- 45
- 70
-
Ok, I implemented the delegate methods and discovered that I'm getting NSNetServicesBadArgumentError (-72004). I've added debugging outputs and here are the arguments being passed: @"_pmobilesync._tcp", @"local.", port 61508. Still returning bad argument error. I've tried with @"" instead of @"local." and also tried the service name with a trailing '.' -- same results. Is there any way to get more information on what the bad argument is? – greg Nov 09 '11 at 22:21
-
can you post your publish message? – jbat100 Nov 09 '11 at 22:30
-
Is there an easy way to get it? I packet sniffed my network and here's a sample packet. FYI: the problem isn't happening on my devices / machine. I can see the service just fine. http://www.barereef.com/resources/dump.txt – greg Nov 10 '11 at 03:20
-
what happens if you use @"_pmobilesync._tcp."? – jbat100 Nov 10 '11 at 06:19
-
Same thing -- that's what I started with. In digging through info online, it was mentioned that the trailing '.' is used when browsing for a service but not when publishing one. But the documentation says otherwise... Are there any requirements for the name field? – greg Nov 10 '11 at 16:17
-
Don't think so, maybe in terms of length. – jbat100 Nov 10 '11 at 16:21
-
I'm trying to get more info on the actual service name that's being published. Because this service could be running on multiple devices, I use the device name as part of the service name to uniquely identify which device is connecting. I suppose it's possible that there's a non-ascii character in the device name that's causing a problem... (grasping at straws) – greg Nov 10 '11 at 16:48
-
So that wasn't the problem (at least I can't reproduce a problem using the same device names). Back to square 1... – greg Nov 12 '11 at 14:52
Make sure you implement ...didNotPublish...
as above. Some routers filter out multicast packets, and unfortunately if you don't control the network there's not an awful lot you can do about it.

- 6,689
- 2
- 26
- 36
-
1As a followup, it looks like some users may have the problem that their local wireless routers do not support mDNS or have UPnP disabled. – greg Mar 28 '12 at 03:35
Another followup: modifying the device name seems to resolve the issue. One user noted that his iPad was discovered but not his iPhone. Bonjour Browser confirmed the presence of the iPad service with no iPhone service. Renaming the iPhone resolved the issue. This is truly an odd behavior.

- 1,926
- 17
- 26