我試圖讓在didFindService功能TXTrecords,但我發現值爲null。如何閱讀TXT記錄與蘋果的Bonjour於iOS
你有什麼想法,解決我的問題呢?
- (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];
}
}
我添加[服務resolveWithTimeout:20]行[self.services ADDOBJECT:服務]之後,但我有同樣的問題 – developer
@AhmedZRIBI:難道你閱讀關於該方法的文檔?您需要等待回調,告訴您服務已經解決。 –