Swift boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics
Asked Answered
O

1

14

I just get an error "[boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics" while to get JSON data from API link. Before it worked and I just updated Xcode version 13.1. I was checking every forum but I couldn't find a way to solve it. Anyone had the same problem before, please help me. Thank you.

func parse() {
    
    let jsonUrlString = "https://api.tiki.vn/shopping-trend/api/trendings/hub?cursor=0&limit=20"
    
    guard let url = URL(string: jsonUrlString)
    else {
        return
    }
    
    URLSession.shared.dataTask(with: url) { [self]
        data, response, err in
        if err != nil {
            print(err as Any)
            return
        }
        do {
            let result = try  JSONDecoder().decode(Data.self, from: data!)
            DispatchQueue.main.async {
                self.items = (result.data?.data)!
                print(items)
            }
        } catch {
            print("Error")
        }
    }
    .resume()
}
Ottilie answered 31/10, 2021 at 9:42 Comment(2)
I have similar errorsFlavopurpurin
It's just an Xcode log warning, you can ignore that. If you put a breakpoint in your project to fix a bug, you'll usually see it. At the time I posted this question, the real cause was that I had wrongly assigned the Double data type to Int. So if your code can't run, you should find another cause.Ottilie
K
11

Try executing this command in Terminal:

xcrun simctl spawn booted log config --subsystem com.apple.network --category boringssl --mode "level:off"

It should turn off these annoying console logs.
Note - if you switch to another iOS Simulator, you have to repeat this command again or consider adding it as a pre-action to your scheme.

Kola answered 19/4, 2022 at 21:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.