Network Connection Issue on Xcode 16.3 Simulator

Hi, I just migrated from Xcode 15 to Xcode 16.3 RC. When I run my app on any simulator, iOS 17 or iOS 18, I seeing strange behavior the second time I launch the app. The app uses a few frameworks, such as Firebase Crashlytics, and the network calls all work fine on the initial launch. however, subsequent launches consistently get the following error:

Task <17ACD3D4-FB31-4091-A797-D573F31909C2>.<2> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x600000c46910 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <17ACD3D4-FB31-4091-A797-D573F31909C2>.<2>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <17ACD3D4-FB31-4091-A797-D573F31909C2>.<2>" ), NSLocalizedDescription=The request timed out.,

The only way to run again on that simulator is to Erase All Content and Settings. I did not see this issue in Xcode 16, and my app has been in production for over a year without networking issues.

Pushing to my phone works fine.

Running on MacBook Pro apple silicon - Sequoia 15.3.2

Any help would be greatly appreciated!

Thanks, Mike

I have the same issue

In the Xcode 16.3 simulator all network requests to our backend fail with error -1001

No issues with the Xcode 16.2 simulator or running on device

Looks like the Xcode 16.3 simulator is not the issue

When the simulator uses 18.4 all network requests return a -1001 error

No issues when the simulator uses 18.3

I have the same story. The iOS 18.4 simulator network stops working on the second launch, but I confirm that it works fine on the iOS 18.3.1 simulator.

I am experiencing the same issue while testing on Xcode 16.3 running iPhone 16 Pro iOS 18.4.

Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x600000c5da70 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x600002160be0 [0x1e6ebb4f0]>{length = 16, capacity = 16, bytes = 0x100201bb226b81ff0000000000000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <74D54E17-5F44-4F67-9334-02D512398432>.<21>,

Getting the same error on XCode 16.3 and simulator version 18.4

Works fine on Real device (18.4) though

Also works fine on 18.3.1

I'm experiencing the same issue, and it seems to be related to Xcode 16.3. A few workarounds that have helped are:

  • Running the app on a physical device

  • Downgrading Xcode from 16.3 to 16.2

  • Downgrading the simulator device from iOS 18.4 to 18.3.1

Here is a relevant post covering the same issue: https://x.com/twostraws/status/1906976838670258594

Having the same issue. Here is the workaround I found:

Don't use URLSession.shared. Instead do the following

let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration)

I have (had) the same issue as sfcoder describes. I recently purchased an M4 Pro, which is great as to the hardware, but not so great as to the forced development path. The M4 Pro meant a new OS (Sequoia), followed by a new requirement (XCode 16.3), and so forth and so on.

As noted by bitsflew, NoHopeNoTop, raahimkhan_, and filipslepcev, downgrading to iOS Simulator 18.3 (from 18.4) did the trick.

Fyi, my new hardware meant I could not move backwards to Xcode 16.2, as recommended by filipslepcev; and my particular code stack meant I could not try changes in session values, as recommended by kuba.libre.

Otherwise, changing from 18.4 to 18.3 was all I needed. Cost me six weeks to find that answer, having traveled thru many a rabbit hole.

I'm seeing the same issues when running my app from Xcode in the iOS 18.4 simulator, as well as Safari itself doesn't seem capable of connecting to any external websites on the simulator. I do not see these issues with the 18.3.1 simulator.

Ditto here, I am running into same issues. I can run the simulator once, but fails on second time with an inability to connect to the network. I have to Erase Content and All Settings to get it to work, but this makes for testing anything with UserDefaults difficult.

How can Apple not have tested this fundamental scenario before releasing?

Network Connection Issue on Xcode 16.3 Simulator
 
 
Q