Are NSURLErrorDomain error messages supposed to appear in the Xcode console?

会有一股神秘感。 提交于 2019-12-24 10:02:50

问题


When testing my app with connectivity turned off (wifi and cellular off), I am able to catch the error. But, in the Xcode console, I can also see the error messages. My code is not printing these to the console. Are these supposed to appear? Can I ignore them?

Task .<1> HTTP load failed (error code: -1009 [1:50]) 2019-07-10 23:33:42.953046-0700 CodeSample[7157:942572] Task .<1> finished with error - code: -1009

The error codes are picked up here:

`let task = session.dataTask(with: request, completionHandler: { (data: Data?, response: URLResponse?, error: Error?) -> Void in
    if error == nil {
        // do non error stuff
    } else {
        // error handling here
    }`

回答1:


Those are system logs printed by the OS. You can disable them from your active scheme.

Edit your scheme and add an environment variable as shown at the image below.



来源:https://stackoverflow.com/questions/56983273/are-nsurlerrordomain-error-messages-supposed-to-appear-in-the-xcode-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!