Post

Replies

Boosts

Views

Activity

Reply to DNSServiceProcessResult users complaining about app freeze
Thank you eskimo for the response. Can you share some high-level APIs that can provide a response for local network access permission? I changed the code to be more in line with the documentation for DNSServiceProcessResult and DNSServiceBrowse What do you think? let startTime = Date() let pointer: UnsafePointerInt8? = NSString(string: "_services._dns-sd._udp").utf8String var browseRef: DNSServiceRef? DNSServiceBrowse(&browseRef, 0, 0, pointer, nil, self?.browseCallback, nil) let socket = DNSServiceRefSockFD(browseRef) let readSource = DispatchSource.makeReadSource(fileDescriptor: socket, queue: DispatchQueue(label: "com.x.y.z")) readSource.setEventHandler() { DNSServiceProcessResult(browseRef) DNSServiceRefDeallocate(browseRef) } readSource.resume() repeat { RunLoop.current.run(mode: .default, before: NSDate.distantFuture) } while (Date().timeIntervalSince(startTime) = TimeInterval(5)); // Waits for 5 seconds and then proceeds
Feb ’21