UDP LAN networking works in simulation but not iPhone device

Hi, I am using react-native-udp. It works in the simulation for Xcode iOS16, but not in the actual iPhone device connected to MacBook.

Also I accidentally find out that it works in iOS14 because the iPhone has not been updated to iOS16. But it does not work in iOS16.

I also notice that if I run for the first time it asks networking and I click allow. I added in info the Privacy - Local Network Usage Description and still does not work on actual device.

Notes : Xcode Version 14.3 (14E222b) iOS ver 16.4.1 on iPhone 11 device. MacBook iOS 13.3

It requires an entitlement from Apple. https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_networkextension https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_multicast

There are three common causes of problems like this:

  • The user has denied your app access to the local network (A).

  • Your local networking code relies on broadcasts (or multicasts), in which case you need the multicast entitlement (B).

  • You have a bug in your UDP code (C). Such code is typically based on BSD Sockets and that’s notoriously tricky to use correctly.

I suspect that you’re actually hitting B. Regardless, the Local Network Privacy FAQ covers A and B.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

UDP LAN networking works in simulation but not iPhone device
 
 
Q