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’.