Post

Replies

Boosts

Views

Activity

Reply to NWConnection not connecting, and not receiving errors
Yes, the summary is correct. The purpose of the connection is solely to obtain the remote endpoint's IP address. But I'm considering having the remote device send its "real" address over. The connection has a protocol framer already, so it wouldn't be a big change. The team that owns the sync API has made some changes to accept and parse the interface. That makes it work, some of the time. Most of the time, sync times out or gets "connection refused".
Apr ’23
Reply to NWConnection not connecting, and not receiving errors
Sorry, I should have provided more context. My API (doSync) needs an IP address. So I pass the endpoint to an NWConnection to resolve the address. But the address is not directly reachable: % ping6 fe80::908d:59ff:fe60:8858 ping6: UDP connect: No route to host Interestingly, adding the interface suffix works. % ping6 fe80::908d:59ff:fe60:8858%en9 PING6(56=40+8+8 bytes) fe80::908d:59ff:fe60:88a7%en9 --> fe80::908d:59ff:fe60:8858%en9 16 bytes from... But my API doesn't understand this address format.
Apr ’23
Reply to NWConnection not connecting, and not receiving errors
The timeout issue is now resolved. The connection class has an optional timeout property, so it can be cancelled either by timeout, or manually. The second issue of not being able to connect is still open, though. The IP address resolved by the Bonjour is link-local, e.g. fe80::908d:59ff:fe60:8858%en9. Connecting to this address fails with "no route to host". If I ask the device for its own address (using the getifaddrs function), it returns a fd60:... address, which I can connect to. The address is resolved like this: func connectionReady(_ connection: NWConnection) throws { guard let remoteEndpoint = connection.currentPath?.remoteEndpoint else { throw NWError.posix(.EADDRNOTAVAIL) } // Connected: get address, and sync with peer switch remoteEndpoint { case .hostPort(let host, _): var addr = "\(host)" print(addr) // prints fe80:...%en9 doSync(with: addr) default: throw NWError.posix(.EDESTADDRREQ) } }
Apr ’23
Reply to NWConnection not connecting, and not receiving errors
Huh... I assumed any error would translate into a stateUpdateHandler call with a .failed(error) case. But okay, I can add a timeout. There is a listener on the other device - that's where the endpoint is coming from. I'm not sure why they can't connect to each other, if they can see one another via Bonjour. The participants are: a simulator running iOS 16.2, and an iPhone running 16.3.1.
Apr ’23
Reply to NWConnection not connecting, and not receiving errors
Yes, the summary is correct. The purpose of the connection is solely to obtain the remote endpoint's IP address. But I'm considering having the remote device send its "real" address over. The connection has a protocol framer already, so it wouldn't be a big change. The team that owns the sync API has made some changes to accept and parse the interface. That makes it work, some of the time. Most of the time, sync times out or gets "connection refused".
Replies
Boosts
Views
Activity
Apr ’23
Reply to NWConnection not connecting, and not receiving errors
Sorry, I should have provided more context. My API (doSync) needs an IP address. So I pass the endpoint to an NWConnection to resolve the address. But the address is not directly reachable: % ping6 fe80::908d:59ff:fe60:8858 ping6: UDP connect: No route to host Interestingly, adding the interface suffix works. % ping6 fe80::908d:59ff:fe60:8858%en9 PING6(56=40+8+8 bytes) fe80::908d:59ff:fe60:88a7%en9 --> fe80::908d:59ff:fe60:8858%en9 16 bytes from... But my API doesn't understand this address format.
Replies
Boosts
Views
Activity
Apr ’23
Reply to NWConnection not connecting, and not receiving errors
The timeout issue is now resolved. The connection class has an optional timeout property, so it can be cancelled either by timeout, or manually. The second issue of not being able to connect is still open, though. The IP address resolved by the Bonjour is link-local, e.g. fe80::908d:59ff:fe60:8858%en9. Connecting to this address fails with "no route to host". If I ask the device for its own address (using the getifaddrs function), it returns a fd60:... address, which I can connect to. The address is resolved like this: func connectionReady(_ connection: NWConnection) throws { guard let remoteEndpoint = connection.currentPath?.remoteEndpoint else { throw NWError.posix(.EADDRNOTAVAIL) } // Connected: get address, and sync with peer switch remoteEndpoint { case .hostPort(let host, _): var addr = "\(host)" print(addr) // prints fe80:...%en9 doSync(with: addr) default: throw NWError.posix(.EDESTADDRREQ) } }
Replies
Boosts
Views
Activity
Apr ’23
Reply to NWConnection not connecting, and not receiving errors
Huh... I assumed any error would translate into a stateUpdateHandler call with a .failed(error) case. But okay, I can add a timeout. There is a listener on the other device - that's where the endpoint is coming from. I'm not sure why they can't connect to each other, if they can see one another via Bonjour. The participants are: a simulator running iOS 16.2, and an iPhone running 16.3.1.
Replies
Boosts
Views
Activity
Apr ’23
Reply to Why is IPA signed with development profile when signing identity is Apple Distribution?
FWIW, the Provisioning Profile under Build Settings is also Automatic. I tried adding CODE_SIGN_IDENTITY="Apple Distribution" to the xcodebuild command, but that failed with "MyApp is automatically signed for development, but a conflicting code signing identity Apple Distribution has been manually specified".
Replies
Boosts
Views
Activity
Aug ’22