简体   繁体   English

NSURLErrorDomain 错误消息是否应该出现在 Xcode 控制台中?

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

When testing my app with connectivity turned off (wifi and cellular off), I am able to catch the error.在关闭连接(wifi 和蜂窝网络关闭)的情况下测试我的应用程序时,我能够发现错误。 But, in the Xcode console, I can also see the error messages.但是,在 Xcode 控制台中,我也可以看到错误消息。 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任务 .<1> HTTP 加载失败(错误代码:-1009 [1:50])2019-07-10 23:33:42.953046-0700 CodeSample[7157:942572] 任务 .<1> 已完成错误 - 代码:- 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
    }`

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.编辑您的方案并添加一个环境变量,如下图所示。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM