tvOS libquic.dylib not found

When debugging a tvOS application that calls Data(contentsOf: URL) I get an error: nw_protocol_get_quic_image_block_invoke dlopen libquic failed: dlopen(/usr/lib/libquic.dylib, 0x0005): tried: [...a number of folders it tried to find the file in...].

I found similar problems here (https://developer.apple.com/forums/thread/693245), but it is not equal, nor does it have a solution.

Any suggestions on how to fix this? I also tried to copy a libquic.tbd file present in other simulators to one of the paths it looks for (a suggestion somewhere on StackOverflow), but it does not help unfortunately.

Answered by DTS Engineer in 721577022

In your tvOS output, this line:

did load, data: 83 bytes

shows the data did load successfully. Everything else is log noise IMO.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Does the Data(contentsOf: URL) then fail? If so, what error does it return?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Yes, Data(contentsOf: URL) fails with the error I copied above. I could copy more lines, but they are just a bunch of paths on my system that were tried for the libquic file.

I uploaded a project to Github that triggers the error: https://github.com/Kobes/DataCallBugDemo

The project is nothing but an empty tvOS project with two lines of code added to ViewController.swift.

The full error reads:

`2022-07-21 19:07:48.850893+0200 DataCallBugDemo[32673:1601116] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed: dlopen(/usr/lib/libquic.dylib, 0x0005): tried: '/Users/myhome/Library/Developer/Xcode/DerivedData/DataCallBugDemo-bciyslbakihyhlgdfkvdrnedngsp/Build/Products/Debug-appletvsimulator/libquic.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection/libquic.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libquic.dylib' (no such file), '/usr/lib/libquic.dylib' (no such file)`

Some additional details: Xcode 13.4.1 (13F100)

Simulator: Apple TV 4K (at 1080p), 2nd generation, tvOS 15.4

The code you posted has a single quote (') at the end of the URL. Was that deliberate?

Also, in that code you throw away the error being returned by Data(contentsOf:). Try this:

do {
    print("will load")
    let d = try Data(contentsOf: url!)
    print("did load, data: \(d)")
} catch {
    print("did not load, error: \(error)")
}

What do you see?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

The compiler gives me this warning when I make it a do...catch block: 'catch' block is unreachable because no errors are thrown in 'do' block

The single quote was a mistake, but removing it does not make a difference. But corrected in the git repo.

I am still getting the exact same error but, predictably, is now preceded by a console message 'will load'.

The compiler gives me this warning when I make it a do...catch block

You must have done that incorrectly. In my code snippet the try on line 3 is a potential source of errors. Did you accidentally leave it as a try??

Consider this snippet:

import Foundation

func test() {
    let url = URL(string: "https://jsonplaceholder.typicode.com/todos/1")
    do {
        print("will load")
        let d = try Data(contentsOf: url!)
        print("did load, data: \(d)")
    } catch {
        print("did not load, error: \(error)")
    }
}

test()

If you put this in a new macOS command-line tool target, it prints:

will load
…
did load, data: 83 bytes

If you take that test() function and put it in your tvOS target, what does it print?

Please include all the output, in a code block like I’ve shown above, not just your summary of it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I did leave in the ? indeed. Apologies.

I tried the same call in a macOS command line app also (did that before posting here, but forgot to mention it) and then it prints the content to the command line as expected. On tvOS however, the error below:

will load

2022-07-25 14:04:45.348040+0200 DataCallBugDemo[35942:1740418] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed: dlopen(/usr/lib/libquic.dylib, 0x0005): tried: '/Users/home/Library/Developer/Xcode/DerivedData/DataCallBugDemo-bciyslbakihyhlgdfkvdrnedngsp/Build/Products/Debug-appletvsimulator/libquic.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection/libquic.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libquic.dylib' (no such file), '/usr/lib/libquic.dylib' (no such file)

2022-07-25 14:04:45.480596+0200 DataCallBugDemo[35942:1740420] [boringssl] boringssl_metrics_log_metric_block_invoke(153) Failed to log metrics

did load, data: 83 bytes

2022-07-25 14:04:45.560389+0200 DataCallBugDemo[35942:1740289] [UIFocus] Failed to update focus with context <UIFocusUpdateContext: 0x600003100320: previouslyFocusedItem=(null), nextFocusedItem=(null), focusHeading=None>. No additional info available.

2022-07-25 14:04:49.076286+0200 DataCallBugDemo[35942:1740289] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358212) use primary keyboard info instead.

2022-07-25 14:04:49.081580+0200 DataCallBugDemo[35942:1740289] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358212) use primary keyboard info instead.

objc[35942]: Class _PathPoint is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x117f3a9a0) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x129bb35d8). One of the two will be used. Which one is undefined.

objc[35942]: Class _PointQueue is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x117f3a978) and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x129bb3600). One of the two will be used. Which one is undefined.
Accepted Answer

In your tvOS output, this line:

did load, data: 83 bytes

shows the data did load successfully. Everything else is log noise IMO.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Wow, you are right. I looked more carefully at the code that send me on this quest again and found some other issues there that I could resolve.

Sorry for bothering you and thanks for taking the time to help me. The log noise is somewhat annoying, specifically in this case, because it seems to point at the origin of not being able to fetch a url while the actual problem could be elsewhere.

Anyway, solved now. Thanks.

@eskimo thanks for pointing out it's just log noise

its super annoying because its lets say "hard noise" suggesting a bad problem, missing library

nothing seems to have changed for a year or two - do you reckon it's worth filing a bug report or ?

its almost that someone needs to write a "known noise filter" for the logs :) it can make it so hard to work on projects

You wrote:

its super annoying

and:

do you reckon it's worth filing a bug report

The first answers the second (-:

Xcode 15’s new console window now supports filtering, and that might be enough to ameliorate the annoyance. See WWDC 2023 Session 10226 Debug with structured logging for the details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

tvOS libquic.dylib not found
 
 
Q