Network connections send and receive data using transport and security protocols.

Posts under Network tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Testing/Debugging Background Session Code
I’m trying to debug background session workflows. I read the excellent article Quinn wrote here: https://developer.apple.com/forums/thread/14855 I’m not seeing the call to exit(0) work for relaunching an app when a background URL Session completes. I’m also not getting the UIApplication.willTerminateNotification in that case. I am testing on an actual device and not hooked up to the debugger. Has anything changed since that article was published? Are there new tips for debugging background URLSession relaunch workflows?
2
0
639
Aug ’23
UDP listener only receives one packet
I have an issue where my iPhone app needs to listen for a UDP packet, and respond to the sender. This works when I first load the app, but after receiving the first packet and responding, it stops receiving any more, and I instead see errors in the logs. Code for UDP Listener: import Foundation import Network import Combine class UDPListener: ObservableObject { var listener: NWListener? var connection: NWConnection? /// New data will be place in this variable to be received by observers @Published private(set) public var messageReceived: Data? /// When there is an active listening NWConnection this will be `true` @Published private(set) public var isReady: Bool = false /// Default value `true`, this will become false if the UDPListener ceases listening for any reason @Published public var listening: Bool = true /// A convenience init using Int instead of NWEndpoint.Port convenience init(on port: Int) { self.init( on: NWEndpoint.Port(integerLiteral: NWEndpoint.Port.IntegerLiteralType(port)) ) } /// Use this init or the one that takes an Int to start the listener init(on port: NWEndpoint.Port) { let params = NWParameters.udp params.allowLocalEndpointReuse = true params.allowFastOpen = true self.listener = try? NWListener(using: params, on: port) self.listener?.stateUpdateHandler = { update in switch update { case .ready: self.isReady = true print("Listener connected to port \(port)") case .failed, .cancelled: // Announce we are no longer able to listen self.listening = false self.isReady = false print("Listener disconnected from port \(port)") default: print("Listener connecting to port \(port)...") } } self.listener?.newConnectionHandler = { connection in print("Listener receiving new message") self.createConnection(connection: connection) } self.listener?.start(queue: .main) } func createConnection(connection: NWConnection) { self.connection = connection self.connection?.stateUpdateHandler = { (newState) in switch (newState) { case .ready: print("Listener ready to receive message - \(connection)") self.receive() case .cancelled, .failed: print("Listener failed to receive message - \(connection)") // Cancel the listener, something went wrong self.listener?.cancel() // Announce we are no longer able to listen self.listening = false default: print("Listener waiting to receive message - \(connection)") } } self.connection?.start(queue: .main) } func receive() { self.connection?.receiveMessage { data, context, isComplete, error in if let unwrappedError = error { print("Error: NWError received in \(#function) - \(unwrappedError)") return } guard isComplete, let data = data else { print("Error: Received nil Data with context - \(String(describing: context))") return } self.messageReceived = data print(String(decoding: data, as: UTF8.self)) if String(decoding: data, as: UTF8.self) == "teststring" { switch self.connection?.endpoint { case .hostPort(let host, let port): print("Sending response to \(host):\(port)") default: break } self.connection?.send( content: String("received").data(using: .utf8), completion: NWConnection.SendCompletion.contentProcessed(({ (NWError) in if (NWError == nil) { print("Data was sent to UDP") } else { print("ERROR SEND! Error when data (Type: Data) sending. NWError: \n \(NWError!)") } })) ) } if self.listening { self.receive() } print(String(self.listening)) } } func cancel() { print("cancelling udp listener") self.listening = false self.connection?.cancel() } }
6
0
652
Aug ’23
NwPathMonitor's pathUpdateHandler block is called without change.
It seems that sometimes the pathUpdateHandler block is called even though the NWPath data is unchanged. Is this known? Or is there some unexposed change to the NWPath struct? 2023-08-23 14:16:02.149962+0900 NWPath -> status: satisfied, unsatisfiedReason: notAvailable, availableInterfaces: ["(type: wifi, name: en0, kernel index: 11)", "(type: cellular, name: pdp_ip0, kernel index: 3)"], isExpensive: false, isConstrained: false, supportsIPv4: true, supportsIPv6: false, supportsDNS: true, gateways: ["(description: 192.168.0.1:0, interface: nil, txtRecord: nil)"], localEndpoint: nil, remoteEndpoint: nil 2023-08-23 14:19:12.077079+0900 NWPath -> status: satisfied, unsatisfiedReason: notAvailable, availableInterfaces: ["(type: wifi, name: en0, kernel index: 11)", "(type: cellular, name: pdp_ip0, kernel index: 3)"], isExpensive: false, isConstrained: false, supportsIPv4: true, supportsIPv6: false, supportsDNS: true, gateways: ["(description: 192.168.0.1:0, interface: nil, txtRecord: nil)"], localEndpoint: nil, remoteEndpoint: nil 2023-08-23 14:19:16.065005+0900 NWPath -> status: satisfied, unsatisfiedReason: notAvailable, availableInterfaces: ["(type: wifi, name: en0, kernel index: 11)", "(type: cellular, name: pdp_ip0, kernel index: 3)"], isExpensive: false, isConstrained: false, supportsIPv4: true, supportsIPv6: false, supportsDNS: true, gateways: ["(description: 192.168.0.1:0, interface: nil, txtRecord: nil)"], localEndpoint: nil, remoteEndpoint: nil
1
0
437
Aug ’23
IOS and Private AP Networks with out Internet
We are manufacturers of home security and automation products. Over the last few years, we have become more dependent on app development and mobile devices. We are experiencing an issue that I am hoping to get some guidance on. As part of a new product we are creating, we need to utilize a private Access Point (AP) network generated by our device to configure it to connect to a Wi-Fi network. This network is a straightforward 2.4GHz Wi-Fi network generated from our product's Wi-Fi module. It is IPv4 and utilizes DHCP for a limited number of leases. This network is only temporary and is used solely for configuring the device, similar to the setup of a Wi-Fi repeater. However, we do not have a built-in Web Server; we utilize an app to make the configurations. The issue we are encountering is that iOS seems to take 60 seconds or more to allow local traffic on the AP network once we connect. It establishes the connection quickly and indicates no internet access, which is correct. Then, observing the mobile device, you can see that the "Wi-Fi Icon" does not appear in the status bar at the top of the phone for a prolonged period. During this time, iOS doesn't permit us to discover our device. We broadcast a discovery message on the private AP to prompt our device to respond, allowing us to establish a connection and initiate the configuration. If we attempt discovery during this "verification" period, our app doesn't get a response from the device, leading to confusion for our customers as they are connected to the device that is not responding. My question is: Is there a document or guideline available that we can follow to enhance the functionality of our network with iOS? Is there a way to inform iOS that we are a private AP without internet access? It appears that the time we are waiting corresponds to iOS exhausting its measures to confirm internet connectivity. This seems to isolated to iOS, we are not seeing this with other mobile devices. Any advice or guidance would be greatly appreciated. Thank you, Mike
2
0
332
Aug ’23
Xcode Error : Building a custom peer-to-peer protocol
Unable to launch this sample project. Xcode says it cannot open the file. Building a custom peer-to-peer protocol I'm trying to build iPhone as a mouse. I am not planning on releasing it but more like a practice for myself. I have one other question, how to use a mac app to receive mouse data while it's in background as it's required by my app. Is Background Tasks the right way ? I am planning to use Network framework for networking but there is not much documentation available. Pardon me if it's a basic question.
1
0
815
Aug ’23
Meaning of values Cert
Hi: I'm wondering about what means values s,i from cert object inside the property NSErrorPeerCertificateChainKey and NSErrorPeerCertificateChainKey in an SSLError: NSErrorPeerCertificateChainKey=( "<cert(0x1029c9e00) s: site.com i: Company Services>" I suppose that "i" is the certificate's issuer and "s" is the site, but something is strange here. I make a request to example.com and sometimes example.com does not appear on the certificate chain ... appearing Other sites and issuers not related to the certificate that example.com could have. I think that it is the cause of the error, but if you could explain to me which could be the cause of this strange situation would be nice. Thanks in advance
1
0
577
Aug ’23
View only the network traffic that exits the mac
Hi, I'm using tcpdump and Wireshark to inspect the network packets that are received and sent from my mac. I'm inspecting the traffic from WiFi interface, but the problem is that the tools display also the traffic that don't exit the system, e.g. the ones that are blocked by the firewall. Is it possible to somehow see the traffic that for sure left the mac? e.g. make a UDP or TCP connection to a remote address, ADDR_1. start sending/receiving packets block all the traffic, received & sent, to the ADDR_1 using e.g. pf rules Wireshark & tcpdump will still show for some time(probably until TCP timeout) the outgoing traffic to ADDR_1, even if the packets are not leaving the mac because are blocked by the firewall. In this case, is it possible to filter out this packets so they are not displayed by the tools? Thanks
2
0
674
Aug ’23
Local Network Privacy FAQ-16
This post is part of the Local Network Privacy FAQ. On a small fraction of devices my app fails to present the local network privacy alert. What’s going on? I most commonly see this in apps with code that specifically targets the Wi-Fi interface. If that code fails, the app might end up targeting the wrong interface. If that interface is not subject to local network privacy, the system never presents the local network privacy alert. IMPORTANT A common cause of this failure is the assumption that en0 is the iPhone’s Wi-Fi interface. While that’s true on most devices, this is not a valid assumption. BSD interface names are not considered API on Apple platforms. Code that makes that assumption will fail in hard-to-reproduce circumstances. If you encounter a problem like this, check whether your code has a hard-coded en0. If it does, see Extra-ordinary Networking for ideas about how to fix it. Back to the FAQ
0
0
415
Aug ’23
Implementing NWProtocolFramerImplementation in ObjC / C
Hi Everyone, Seeing that most of the resources out there are 'primarily' geared towards supporting swift, some of us such as myself still fancy Objective-C. I am currently working on a network project and I'm considering writing my own framer to just get a feel for how it works but I'm seriously running into issues with how to do this. for example: how would I begin doing this in C final class FrProtocol:NWProtocolFramerImplementation{ } which requires creating a definition passing in the class itself NWProtocolFramer.Definition(implementation: FRProtocol.self) I had a look at framer_options.h and although I see some of the functions that need to be implemented when conforming to the above said protocol. It's confusing to say the least how to begin. It would be nice to have samples that are written for Objective-C. Any help would be most appreciated.
2
0
383
Sep ’23
How to track down cause of SSL Errors - NSURLErrorDomain Code=-1200
I've noticed that our apps get these errors with some regular occurrence: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made. I suspect the issue may be because of misconfigured VPNs. But is there any way to get more details about the cause of these SSL failures? If it's an issue with certificate validation or something, it would be great to get the certificate seen at the time of the error as sometimes a simple retry ends up working. I'm not doing anything particularly special network-wise... using standard URLSession with the default configuration. I have tried implementing URLSessionDelegate.urlSession(:didBecomeInvalidWithError:) and URLSessionDelegate.urlSession(:didReceive:completionHandler:) to see if I could get more details, but nothing.
3
0
870
Sep ’23
NWConnection performance on iOS is wildly inconsistent
I have an system that is designed around a collection of devices (iPhones or iPads) discovered via bonjour and connected with a NWConnection over TCP. Commands issued from one of the devices are sent to each of the peers and should be executed as soon as they are received. The problem I am encountering is a high variability in transit time device to device that I am having a hard time accounting for. By 'high' I am noting anywhere from 20-80ms of latency device to device. CPU utilization on each iPhone is essentially 0. Keepalives are enabled and firing off every 2 seconds. Additionally, the physical devices all have bluetooth off (as recommended in other posts) The interesting part is when I add into the connection mix an iPhone simulator (running on either a M1 MacBook Air, or my M1U Studio). When a command is issued from the simulator instance, all connected devices report back anywhere within ~0-3ms of deviation from the initiator, which is more what I expect from the network. Thinking that it's perhaps the M1 series of chips being far and away more competent than the A15's in the iPhone 13's and 14 that are in my testbed, I added my M1 iPad to the mix. Invoking a command from the iPad has similar variability as invoking it from one of the iPhones. The code is stupid simple and I'm posting here prior to opening up a DTS case in the hope that there's a magic "shouldUseSpeedholes=true" flag I can set. I have gone through several variations: using UDP instead of TCP (worse variations), changing from a listener/browser on each device to a single browser, multiple listener (no difference), changing from keeping things on the main queue (as in the docs) to a separate concurrent high priority dispatch queue (no difference). There is no TLS in the mix. I have tried both allowing peer-to-peer as well as not (no difference). I'm even using a single purpose project instead of my main codebase to isolate everything else that could be messing with scheduling with communications. I've tried each band of my WIFI (2.4 and 2x5ghz SSIDs) - no change. Sending func send(option: AppFramingOptions, withData data: Data?) { let message = NWProtocolFramer.Message(appFramingOption: option) let context = NWConnection.ContentContext(identifier: "\(option.rawValue)", metadata: [message]) for (uniqueKey, connection) in connections { if uniqueKey.contains(serviceName) { connection.send(content: data, contentContext: context, isComplete: true, completion: .idempotent) } } } In the above function, I am looking for the serviceName because I want to use connections connected via the browser as opposed to the listener (which isn't tagged with service name info in the endpoint). The check avoids a device receiving the command twice. Receiving connection.receiveMessage { content, contentContext, isComplete, error in guard error == nil else { connection.cancel() return } if let msg = contentContext?.protocolMetadata(definition: AppFraming.definition) as? NWProtocolFramer.Message { switch msg.appFramingOption { default: self.messageReceivedHandler?(content, msg.appFramingOption, Date().timeIntervalSince1970, withUniqueKey) } } receiveMessage() } } It's very much patterned off the TicTacToe example code (with a mechanism for multiple connections). My next step is embedding a web server in each device and making REST calls rather than commands over a TCP stream (which is CRAZY INSANE I KNOW). I also do not want to have to have a Macintosh dependency for this system because I cannot get predictable(ish) transit times. Any help is appreciated!
3
0
808
Sep ’23
UDP listener only receives one packet and show Errors
I have an issue where my iPhone app needs to listen for a UDP packet and print that data to the screen. UDP packets are sent by a PC connecting to a Wifi router and my Iphone is also connecting to it and listening on the correct port. When running the App, it works at the first moment and receives the first UDP packet co, but after receiving the first packet, it stops receiving more and I see errors in the logs. These errors only appear when I test directly on the Iphone receiving packets through the router's wifi network with ip: 192.168.0.1. When I run through the simulator using localhost (127.0.0.1 ) the errors do not appear and I receive all packages correctly. Code for UDP listener: class UDPConecct: ObservableObject { var listener: NWListener? var connection: NWConnection? var queue = DispatchQueue.global(qos: .userInitiated) /// New data will be place in this variable to be received by observers @Published private(set) public var messageReceived: Data? /// When there is an active listening NWConnection this will be `true` @Published private(set) public var isReady: Bool = false /// Default value `true`, this will become false if the UDPListener ceases listening for any reason @Published public var listening: Bool = true var port: NWEndpoint.Port @Published var receivedWords: [Float64] = [] @Published var isCaptureStarted = false //@Published var udpPacket: UDP_Packet? /// A convenience init using Int instead of NWEndpoint.Port convenience init(on port: Int) { self.init(on: NWEndpoint.Port(integerLiteral: NWEndpoint.Port.IntegerLiteralType(port))) } /// Use this init or the one that takes an Int to start the listener init(on port: NWEndpoint.Port) { self.port = port let params = NWParameters.udp params.allowFastOpen = true self.listener = try? NWListener(using: params, on: port) self.listener?.stateUpdateHandler = { update in switch update { case .ready: self.isReady = true print("Listener connected to port \(port)") case .failed, .cancelled: // Announce we are no longer able to listen self.listening = false self.isReady = false print("Listener disconnected from port \(port)") default: print("Listener connecting to port \(port)...") } } self.listener?.newConnectionHandler = { connection in print("Listener receiving new message") self.createConnection(connection: connection) } self.listener?.start(queue: self.queue) } func createConnection(connection: NWConnection) { self.connection = connection self.connection?.stateUpdateHandler = { (newState) in switch (newState) { case .ready: print("Listener ready to receive message - \(connection)") self.receive() case .cancelled, .failed: print("Listener failed to receive message - \(connection)") // Cancel the listener, something went wrong self.listener?.cancel() // Announce we are no longer able to listen self.listening = false default: print("Listener waiting to receive message - \(connection)") } } self.connection?.start(queue: .global()) } func receive() { self.connection?.receiveMessage { data, context, isComplete, error in if let unwrappedError = error { print("Error: NWError received in \(#function) - \(unwrappedError)") return } guard isComplete, let data = data else { print("Error: Received nil Data with context - \(String(describing: context))") return } self.handleCapturedData(data) if self.listening { print("escutando") self.receive() } } } func handleCapturedData(_ data: Data) { print("quantidade de dados", data.count) var value: [Float64] = [] if data.count % 2 != 0 { let startOffset = 1 let length = (data.count-1)/2 let range = startOffset..&lt;startOffset+length // Fatiando o Data Recebido via UDP usando o intervalo let slicedData = data.subdata(in: range) print("dados cortados:", slicedData) for i in stride(from: 0, to: slicedData.count, by: 8) { let startIndex = i let endIndex = min(i + 8, slicedData.count) let subarray = Array(slicedData[startIndex..&lt;endIndex]) let floatValue = subarray.withUnsafeBytes { $0.load(as: Float64.self) } value.append(floatValue) } print("Dados Recebidos", value) self.receivedWords = value } else { let startIndex = 14 let endIndex = data.count - 2 let relevantData = Array(data[startIndex..&lt;endIndex]) // Iterar sobre os dados de 16 bits e convertê-los para Double for i in stride(from: 0, to: relevantData.count, by: 2) { let byte1 = relevantData[i] let byte2 = relevantData[i + 1] let wordValue = UInt16(byte1) &lt;&lt; 8 | UInt16(byte2) let doubleValue = Double(wordValue) value.append(doubleValue) } self.receivedWords = value print("Dados Recebidos 2", value) } } func cancel() { self.listening = false self.isCaptureStarted = false self.connection?.cancel() } }
6
0
631
Sep ’23
Connect On Demand not working as predicted on macOS browsers except Safari
We set below rule for IKEv2 / IPSec / NETunnelProviderManager custom protocols. where trusted domain contains www.whatismyipaddress.com and manually connected to VPN. NEEvaluateConnectionRule *evalConnectionRule = [[NEEvaluateConnectionRule alloc] initWithMatchDomains:self.trustedDomains andAction:NEEvaluateConnectionRuleActionNeverConnect]; NEOnDemandRuleEvaluateConnection *onDemandRule = [NEOnDemandRuleEvaluateConnection new]; onDemandRule.connectionRules = @[ evalConnectionRule ]; [activeRules addObject:onDemandRule]; [NEVPNManager sharedManager].onDemandRules = [evalConnectionRule]; [NEVPNManager sharedManager].onDemandEnabled = YES; [NEVPNManager sharedManager].enabled = YES; [[NEVPNManager sharedManager].connection startVPNTunnelAndReturnError:&connError]; www.whatismyipaddress.com shows correct public IP address and www.whatismyip.com shows correct VPN server address on Safari. Above code snippet working fine on iOS / iPadOS on all bowsers but not on macOS browsers except Safari. Is there something I'm missing here? Are there other settings that we have to configure in our NEVPNManager/NETunnelProviderManager for macOS specifically? We are testing this in macOS Ventura.
1
0
399
Sep ’23
WPA3-Personal with the WAC POSIX Server
I am developing a WAC enabled Airplay device that cannot be added to WPA3-Personal networks using iOS or macOS. Neither macOS (AirPort Utility) nor iOS (Wi-Fi Settings) allow me to select the WPA3-Personal network despite being on this same WPA3-Personal network. My device supports WPA3-Personal. Using non-Apple on-boarding methods are successful with WPA3-Personal networks. Is there something I'm missing in my implementation of the WAC for supporting WPA3-Personal?
1
0
421
Sep ’23
A problem about networking-multicast
Hello everyone, I seem to have a problem with networking-multicast permissions. The program we developed uses the UPnP protocol, so we applied for networking-multicast permission for our development plan. Reference: < https://developer.apple.com/contact/request/networking-multicast>. After that, we set Identifiers with check Multicast Networking in Additional Capabilities and update Profiles. After rebuilding the program, the program can find UPnP devices in the network on my iPhone, and it does work. The program is developed using Flutter, runs on both iOS/Android platforms, and has both professional and regular versions. No matter which platform or version can work properly. When only one program is installed on an iOS device, everything is fine. But if two programs are installed on the same device at the same time (for example, our professional version and normal version, BundleID is different), various problems will occur: case 1: Install the normal version Start the normal version: Does work case 2: Install the professional version Start the professional version: Does work case 3: Install the normal version Install the professional version Start the normal version: Unable to discover UPnP device Start the professional version: Unable to discover UPnP device case 4: Install the professional version Install the normal version Start the professional version: Unable to discover UPnP device Start the normal version: Unable to discover UPnP device case 5: Install the normal version Start the normal version: Does work Install the professional version Start the professional version: Does work case 6: Install the professional version Start the professional version: Unable to discover UPnP device Install the normal version Start the normal version: Unable to discover UPnP device Sum up the phenomenon: There is no problem with installing a separate program. Install two programs at the same time: it will work only if it is executed in a specific order (case 5). Add a few points: We use Flutter development, iOS and Android use the same code. There is no problem with the above case on Android. 2. We use flutter_flavor ( reference: https://pub.dev/packages/flutter_flavor) configuration ordinary version & professional version. 3. In all cases where problems occur, the pop-up window of the system requesting networking-multicast will not pop up. It looks like that UPnP is not working because of permissions. 4. In all cases only one Application run at anytime. Before starting the new program, we will forcibly exit the other program to ensure that the port is released. 5. We found an UPnP programs developed by other developers on the Appstore, which do not conflict with our regular version or professional version, and both sides can work properly. We think this looks like a bug of the iOS system. I wonder if anyone else has encountered a similar situation? Would you like to give us a hint of the direction of our solution? Thank you very much. Or at least, I wonder if anyone can help us figure out whether this problem is the bug of the iOS system or the problem of our program itself. Thanks a lot.
1
0
348
Sep ’23
Local Network Privacy FAQ-17
This post is part of the Local Network Privacy FAQ. Why does local network privacy get confused when I install two variants of my app? Local network privacy relies on NECP, a subsystem on Apple platforms that controls which programs have access to which network interfaces. For a brief introduction to this, see A Peek Behind the NECP Curtain. Internally, NECP uses a program’s main executable Mach-O UUID (LC_UUID) to track the identity of that program. If you have two programs with the same UUID, NECP might get confused (r. 30421029). This most commonly happens when you have two variants of the same app that you build from the same source code. For example, you might have a Pro and a Lite version of your app that use the same code. Or you might a core app implementation that you ‘skin’ for different customers by changing just the resources. If you encounter weird local network privacy interactions between two apps, check their LC_UUID values. To do this, run dwarfdump against the app’s main executable. For example: % dwarfdump --uuid Test725715-A.app/Test725715-A UUID: 2406B68D-B76A-3D70-8264-16F4A8E07DC0 (arm64) Test725715-A.app/Test725715-A % dwarfdump --uuid Test725715-B.app/Test725715-B UUID: D4D74EA8-FC68-3925-92AB-7B279DA095F9 (arm64) Test725715-B.app/Test725715-B Note While macOS doesn’t support local network privacy, duplicate UUIDs can cause weird problems with other NECP-based systems. macOS apps have a slightly different bundle structure, so insert Contents/MacOS/ in the path you pass to dwarfdump. For example, if you have a macOS app called Test725715-A, use the path Test725715-A.app/Contents/MacOS/Test725715. In this example the UUIDs are different, which is what you’d expect. If you see the same UUID for both apps, take steps to fix that. If you’re using Xcode, the easiest way to ensure that you have different UUIDs is to build your app from different source code. Here’s one approach that works: Create two source files, Unique-A.m and Unique-B.m. Add each file to its corresponding target. In each file define a string constant with the same name and a different value. For example, Unique-A.m might have: const char * gUnique = "Hello from app A!"; while Unique-B.m has: const char * gUnique = "Hello from app B!"; In your main function, add code to print that value: extern char * gUnique int main(…) { … printf("%s\n", gUnique); … } IMPORTANT Printing gUnique ensures that it’s not dead stripped. Now rebuild your apps and run the dwarfdump test again to confirm that each variant has a different UUID. Note This example is in Objective-C because this issue is less common with Swift code. That’s because in Swift the app’s name becomes the module name. This is reflected in the Swift runtime metadata, which is linked into the app, causing each app to have a different UUID. If you’re building your app with third-party tooling, consult the tool’s vendor as to how best to resolve this issue with their tools. Back to the FAQ
0
0
453
Sep ’23
Network framework crashes on fork
Hello, I have a Cocoa application from which I fork a new process (helper sort of) and it crashes on fork due to some cleanup code probably registered with pthreads_atfork() in Network framework. This is crash from the child process: Application Specific Information: *** multi-threaded process forked *** BUG IN CLIENT OF LIBPLATFORM: os_unfair_lock is corrupt Abort Cause 258 crashed on child side of fork pre-exec Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_platform.dylib 0x194551238 _os_unfair_lock_corruption_abort + 88 1 libsystem_platform.dylib 0x19454c788 _os_unfair_lock_lock_slow + 332 2 Network 0x19b1b4af0 nw_path_shared_necp_fd + 124 3 Network 0x19b1b4698 -[NWConcrete_nw_path_evaluator dealloc] + 72 4 Network 0x19af9d970 __nw_dictionary_dispose_block_invoke + 32 5 libxpc.dylib 0x194260210 _xpc_dictionary_apply_apply + 68 6 libxpc.dylib 0x19425c9a0 _xpc_dictionary_apply_node_f + 156 7 libxpc.dylib 0x1942600e8 xpc_dictionary_apply + 136 8 Network 0x19acd5210 -[OS_nw_dictionary dealloc] + 112 9 Network 0x19b1beb08 nw_path_release_globals + 120 10 Network 0x19b3d4fa0 nw_settings_child_has_forked() + 312 11 libsystem_pthread.dylib 0x100c8f7c8 _pthread_atfork_child_handlers + 76 12 libsystem_c.dylib 0x1943d9944 fork + 112 (...) I'm trying to create a child process with boost::process::child which does basically just a fork() followed by execv() and I do it before the - [NSApplication run] is called. Is it know bug or behavior which I've run into? Also what is a correct way to spawn child processes in Cocoa applications? As far as my understanding goes the basically all the available APIs (e.g. posix, NSTask) should be more or less the same thing calling the same syscalls. So forking the process early before main run loop starts and not starting another NSApplication in forked child should be ok ...or not?
3
0
1.2k
Sep ’23
Adding Multicast Networking Entitlement to my App
Hi! I've applied for and received the multicast networking entitlement. I'm befuddled as to how to apply it. I'm somewhat new to iOS development. I've followed the instructions in this developer page as per the instructions in the email confirmation I received re entitlement granting. https://developer.apple.com/forums/thread/663271 I've logged into my developer account, navigated to identifiers, and checked/enabled Multicast Networking under Additional Capabilities and saved them. What do I do next? I've re-started Xcode but this new capability does not show up in my app. I've tried running codesign utility but the examples in the above url don't work. Any pointers/suggestions as to how to get this entitlement into my app? Thanks, Bobby
3
0
741
Sep ’23
Cannot access the internet while Network Link Conditioner is enabled, regardless of profile settings
Hi there! I'm not a dev, but I use NLC to limit my Mac's bandwidth when I'm downloading files so that other people in the household won't get slower internet speed. In the past, I just needed to turn it on and that was it, but recently, whenever I turned it on on my Mac, I'm completely disconnected from the internet. I tried disconnecting and reconnecting the wifi to no avail, and I've tried all the profiles. Anyone has any ideas on how to resolve this? Is it a bug? Thanks in advance!
0
0
241
Sep ’23