Same issue on iOS 18.1.1 in my thread 769984.
Post
Replies
Boosts
Views
Activity
Besides modifying the code and performing a build & run, restarting the iPhone device also allows the connection to succeed.
I believe this issue aligns with the one discussed in this thread: 768666
I have updated my development environment, but the issue remains the same.
Development environment:
macOS: 14.7.1
Xcode: 16.1
Deployment Target: iOS 18.1
iPhone Device OS: iOS 18.1
I also conducted RVI traces, and they show that no traffic is being sent from the iPhone. Do you have any additional suggestions on how to debug this issue?
Thank you for your response. I tried your code, but it still returned the following log:
connection will start
connection did change state, new: waiting(POSIXErrorCode(rawValue: 50): Network is down)
connection did change state, new: preparing
connection did change state, new: waiting(POSIXErrorCode(rawValue: 50): Network is down)
My iPhone device OS version is 18.1, but the iOS Deployment Target in Xcode is set to 17.4. This might be the issue. I will upgrade my system and Xcode version and try again.
Here’s a recap of the process:
Upon the first installation of the app, executing NWConnection.start() triggers the prompt: “Allow [App Name] to find devices on the local network”.
After selecting “Allow,” the app receives the error: waiting(POSIXErrorCode(rawValue: 50): Network is down).
Using an RVI packet trace reveals no traffic from the iPhone.
Restarting the app, device, and server yields the same result.
Clean project, build and run the app without modifying any code also yields the same result.
Adding a new line in a comment (no functional code changes), build and run the app allows it to connect successfully.
Restarting the app, device, and server after this also works, and the app continues to connect successfully.
Using an RVI packet trace after this shows data being exchanged between 192.168.1.154 and 192.168.1.157.
This is my first time working with the Network Framework, any hints or suggestions would be appreciated!
After removing NSAllowsLocalNetworking, I deleted and reinstalled the app on my iPhone, and it was able to successfully access the server and return data. However, without changing the code, if I delete and reinstall the app again, it reverts to the previous issue of being unable to connect.
At this point, if I change 192.168.1.154 to Erics-MacBook-Pro.local, the connection works again. But after deleting and reinstalling the app without making any code changes, it reverts to the same issue of being unable to connect.
It seems like the app can successfully connect on the first installation after modifying some settings.
I set up a new RVI for the iPhone and recorded a trace. During the trace, I issued a request from the device and then completed the trace, generating a pcap file. However, upon analyzing the pcap file, I couldn’t find any traffic related to IP 192.168.1.154 or port 1234. This indicates that there was no traffic on the ‘wire’.