iOS App freeze while initializing realm with a strange error

Once the app execute the “try! Realm()” command, it outputs on the command line " nw_protocol_get_quic_image_block_invoke dlopen libquic failed" and app just freeze and never execute the next line. I don’t know what to do and I can’t find any useful solution on the web. Can anyone help me?

Welcome to the forums.

When posting, it’s a best practice to include some code and then information about your setup. In this case we would want to know what versions of the macOS, XCode and Realm are installed. Maybe include your podfile and then a section of code that’s causing the issue.

Then, include some of your troubleshooting; did you add a breakpoint before that line and step through the code to see if anything else was not right before that line? Did you ensure you are using a current Realm version? Also, is this a local or sync’d realm?

Update your question and we’ll take a look.

I’m using macOS11.2, XCode 12.3(12C33),and the default version of realm which is 10.7.0.

This is my Podfile:

# Uncomment the next line to define a global platform for your project
 platform :ios, '11.0'

target 'A Cup' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  pod "WaveAnimationView"
  pod 'RealmSwift'
  pod 'ZFRippleButton'
  # Pods for A Cup

  target 'A CupTests' do
    inherit! :search_paths
    # Pods for testing
  pod 'RealmSwift'
  end

  target 'A CupUITests' do
    # Pods for testing
  end

end

I have set two breakpoints before and after the try! Realm(). The app paused before that line, and I pressed that “run the next line” button, and all buttons turned grey. After a long wait, there’s still no sign that then next breakpoint was activated. It seems that the app froze and never execute the next line. There’s no code calling realm before this line, and this line is in the ViewDidLoad().

This is a local realm, and I haven’t configure anything about sync’d realm.

I’ll be appreciate of the solution.

Ok. so far everything looks correct. Can you now share some code? Does the issue occur in the simulator only or on an actual device?

It happens on both simulator and actual device. I didn’t make any change to the AppDelegate.swift file, and I called try! Realm() on the ViewDidLoad() in the first view’s viewcontroller file, which I think is the most prior method called. I mean, before the try! Realm() , I didn’t wrote or override anything before this line, and code after this line shouldn’t affect the initialization of realm…
So I don’t know what code I should share…

Realm doesn’t just crash for no reason. We build and rebuild Realm projects on a daily basis without encountering the issue you’re describing - that that indicates there’s something different about your project than ours.

Some troubleshooting to eliminate variables on your part would in order:

Performing an internet search reveals that error in other situations as well - it’s possible one of your other podfiles is causing the error and it’s unrelated to Realm.

Have you tried to create a brand new project and only add RealmSwift to it? e.g. your podfile would only contain the RealmSwift pod?

If that works add another pod and build and run; does the error re-occur?

If not, adding another; does that cause the error?

These are the steps in finding errors - narrow it to a minimal amount of variables and start adding them back in until the problem happens - then you’ve isolated it.

Well, I’m still not able to isolate the problem, but I got more outputs this time.
Here’s the output:
2021-03-01 23:56:20.989269+0800 A Cup[12320:544065] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
2021-03-01 23:56:31.378352+0800 A Cup[12320:544062] Connection 1: received failure notification
2021-03-01 23:56:31.378518+0800 A Cup[12320:544062] Connection 1: encountered error(3:-9816)
2021-03-01 23:56:31.378992+0800 A Cup[12320:544062] [connection] nw_connection_copy_connected_local_endpoint [C1] Connection has no connected path
2021-03-01 23:56:31.379197+0800 A Cup[12320:544062] [connection] nw_connection_copy_connected_remote_endpoint [C1] Connection has no connected path
2021-03-01 23:56:31.381309+0800 A Cup[12320:544062] Task <011C542E-AC30-4F40-9ADF-BDF5B6FA65A1>.<2> HTTP load failed, 0/0 bytes (error code: -1200 [3:-9816])

So what does it mean?

It means you should do some further troubleshooting as mentioned previously; please start a new project and use a podfile that only contains RealmSwift. Build and run and see if you get the same error.

Well, finally I solved that. When setting datamodels, I have set a few variables to getter type, which caused that problem. After setting them to a specific value, problem solved. I apologize that I didn’t isolate the problem carefully before.
Btw, may I ask why the problem occur when I set the variable to a getter type?

Glad you found the issue! This is why we ask for code, models etc because without that, we’re just guessing.

To answer that we would need to see how the Realm Objects (models) are set up so we can see what you mean by a getter type (Realm doesn’t have “getter” types).