Timeout, but only from iOS Simulator (device fine)


I was just trying to login using my Realm app.

On my iPhone, and on macOS, it works fine - the login is successful.

The issue is that only on the iOS Simulator, I get:

Task <96D401D2-F4F1-4A11-8D02-1385C4CBD1C1>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x6000009eb690 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <96D401D2-F4F1-4A11-8D02-1385C4CBD1C1>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <96D401D2-F4F1-4A11-8D02-1385C4CBD1C1>.<1>"
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://realm.mongodb.com/api/client/v2.0/app/_my_id_here_/location, NSErrorFailingURLKey=https://realm.mongodb.com/api/client/v2.0/app/_my_id_here_/location, _kCFStreamErrorDomainKey=4}


let realmApp = RealmSwift.App(id: "_my_id_here_")
realmApp.login(credentials: .anonymous) { result in
    switch result {
    case .success(let user):
	    // physical iOS device & macOS go here      
    case .failure(let error):
		// iOS Simulator goes here

I have restarted the simulator, erased all content & settings etc.

This is with Xcode 12.5 beta 2, using Realm at master (c5c5e67)

Any ideas why this might happen?


I have a three line test project that reproduces this issue:

To run, simply clone it & wait for Xcode to download Realm as a Swift Package Manager dependency

Running it for Mac, or a physical iOS device, logs:

Result: success(<RLMUser: 0x600002aa7680>)

But running it in iOS Simulator:

Result: failure(Error Domain=realm::app::CustomError Code=-1001 “The request timed out.” UserInfo={NSLocalizedDescription=The request timed out., realm::app::CustomError=code -1001})


I reproduced it with the example project above on another laptop, again using Xcode 12.5 beta 2

However, on Xcode 12.4, it works fine.

So, definitely something reproducible going on here.

Posted it in GitHub as that seems to be where the bugs go… https://github.com/realm/realm-cocoa/issues/7152