我试图在didFindService函数中获取TXTrecords,但我发现该值为null.
你有什么想法解决我的问题吗?
- (void)netServiceBrowser:(NSNetServiceBrowser*)netServiceBrowser didFindService:(NSNetService*)service moreComing:(BOOL)moreComing { [self.services addObject:service]; NSDictionary* dict = [[NSNetService dictionaryFromTXTRecordData:[service TXTRecordData]] retain]; MyTreeNode *node = [[MyTreeNode alloc] initWithValue:[service name]]; NSString* info = [self copyStringFromTXTDict:dict which:@"info"]; if([info isEqualToString:@"child"]) { // info == null and dict == null?? [treeNode addChild:node]; } [info release]; if (!moreComing) { [self sortAndUpdateUI]; } }