I have the problem in resolving NSNetService
. i have successfully resolved NSNetService
when NSNetServiceBrowser
find that service.
-(void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing{
if (![self.services containsObject:aNetService]) {
[aNetService setDelegate:self];
[aNetService resolveWithTimeout:5.0];
}
}
then this method is successfully called
-(void)netServiceDidResolveAddress:(NSNetService *)sender{
NSArray *addresses = [ns addresses];
NSDictionary* dict = [NSNetService dictionaryFromTXTRecordData:[sender TXTRecordData]];
// Here both values are ok
}
but i want to resolve NSNetService to server side to get the IP address on which that service is published.
-(void)netServiceDidPublish:(NSNetService *)ns{
[ns setDelegate:self];
[ns resolveWithTimeout:5.0];
}
but here this method is not calling.
-(void)netServiceDidResolveAddress:(NSNetService *)sender{
}
however i did this
-(void)netServiceDidPublish:(NSNetService *)ns
{
NSArray *addresses = [ns addresses]; // this gives null
// this also gives null
NSDictionary* dict = [NSNetService dictionaryFromTXTRecordData:[sender TXTRecordData]];
}
but values are null
.
please help me if it is possible. any help will be appreciated. thanks in advance.
Had this problem the other day as well, and took me a while to figure it out. For some reason, I needed to assign aNetService to a property.