TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Day 52 Challenge 3 - strange error

Forums > 100 Days of SwiftUI

I'm getting a very strange error every time I try to place the order. This is what the console says :

nw_protocol_get_quic_image_block_invoke dlopen libquic failed

I've tried comparing my code to what others have posted online but i don't see what I'm doing wrong...

Here's my checkout view:

import SwiftUI

struct CheckoutView: View {

    func placeOrder(){
        guard let encoded = try? JSONEncoder().encode(orderC.orderS) else {
            print("Failed to encode order")

        let url = URL(string: "")!
        var request = URLRequest(url: url)
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.httpMethod = "POST"
        request.httpBody = encoded

        URLSession.shared.dataTask(with: request){ data, response, error in

            guard let data = data else{
                print("No data in response: \(error?.localizedDescription ?? "Unknown Error").")
                let message: String = error?.localizedDescription ?? "Unknown error occured"
                self.errorMessage = message
                self.showingError = true

            if let decodedOrder = try? JSONDecoder().decode(OrderS.self, from: data){
                self.confirmationMessage = "Your order for \(decodedOrder.quantity) x \(OrderS.types[decodedOrder.type].lowercased()) cupcakes is on its way!"
                self.showingConf = true
            } else {
                print("Invalid response from server")



    @State private var confirmationMessage = ""
    @State private var showingConf = false

    @State private var errorMessage = ""
    @State private var showingError = false

    @ObservedObject var orderC: OrderC
    var body: some View {

        GeometryReader{ geo in

                        .frame(width: geo.size.width)

                    Text("Your order total is: $\(orderC.orderS.cost, specifier: "%.2f")")

                    Button("Place order"){

        }.navigationBarTitle("Checkout", displayMode: .inline)
        .alert(isPresented: $showingConf){
            Alert(title: Text("Thank you!"), message: Text(confirmationMessage), dismissButton: .default(Text("OK")))
        .alert(isPresented: $showingError){
            Alert(title: Text("Error"), message: Text(errorMessage), dismissButton: .default(Text("OK")))


struct CheckoutView_Previews: PreviewProvider {
    static var previews: some View {
        CheckoutView(orderC: OrderC())

and here's my Order class and struct:

class OrderC: ObservableObject{

    @Published var orderS = OrderS()


struct OrderS: Codable {

        static var types = ["Vanilla", "Chocolate", "Strawberry", "Rainbow"]

        var type = 0
        var quantity = 3
        var specialRequestEnabled = false{
                if specialRequestEnabled == false{
                    self.extraFrosting = false
                    self.addSprinkles = false

        var extraFrosting = false
        var addSprinkles = false

        var name = ""
        var streetAddress = ""
        var city = ""
        var zip = ""

        var hasValidAddress: Bool {

            let nameed = name.trimmingCharacters(in: .whitespacesAndNewlines)
            let added = streetAddress.trimmingCharacters(in: .whitespacesAndNewlines)
            let cityed = city.trimmingCharacters(in: .whitespacesAndNewlines)
            let ziped = zip.trimmingCharacters(in: .whitespacesAndNewlines)

            if nameed.isEmpty || added.isEmpty || cityed.isEmpty || ziped.isEmpty {
                return false
            return true

        var cost: Double{

            var cost = Double(quantity) * 2

            cost += (Double(type) / 2)

            if extraFrosting{
                cost += Double(quantity)

            if addSprinkles{
                cost += (Double(quantity) / 2)

            return cost

    init() { }



There is another related question (for the same error) - here

Maybe that will help.

Seems to be, from what I read, that for the moment it is possible to ignore the error.


Thank you! I can't seem to get the app to run properly though... Nothing happens when I click the 'place order' button, and then this error shows up in the console. I'n not sure what part of my code is wrong...


@7elysium, did you solve this Challenge 3? Anybody chime in here? Would really appreciate some help. I also made a post about Project 10 Challenge 3. Thanks.


Hacking with Swift is sponsored by Superwall.

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.