最简单的Alamofire示例。main.swift:
import Alamofire
import Foundation
AF.request("https://httpbin.org/get").response { response in
// debugPrint(response)
}
RunLoop.current.run()写入调试控制台输出,例如:
2021-10-02 14:45:28.198648+0300 AlamofireExp1[4891:191952] [logging] volume does not support data protection, stripping SQLITE_OPEN_FILEPROTECTION_* flags
2021-10-02 14:45:28.199070+0300 AlamofireExp1[4891:191952] [logging] volume does not support data protection, stripping SQLITE_OPEN_FILEPROTECTION_* flags
2021-10-02 14:45:28.626982+0300 AlamofireExp1[4891:191952] [connection] nw_endpoint_handler_set_adaptive_read_handler [C1.1 54.159.86.231:443 ready socket-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed
2021-10-02 14:45:28.627089+0300 AlamofireExp1[4891:191952] [connection] nw_endpoint_handler_set_adaptive_write_handler [C1.1 54.159.86.231:443 ready socket-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for write_timeout failed
2021-10-02 14:45:28.756444+0300 AlamofireExp1[4891:191941] [logging] volume does not support data protection, stripping SQLITE_OPEN_FILEPROTECTION_* flags
2021-10-02 14:45:28.756749+0300 AlamofireExp1[4891:191941] [logging] volume does not support data protection, stripping SQLITE_OPEN_FILEPROTECTION_* flags问:如何抑制这个垃圾(对我来说)输出到调试控制台?
发布于 2021-10-03 04:33:30
这不是Alamofire日志记录,这是从底层操作系统进行日志记录。不幸的是,没有好的方法来禁用它。从技术上讲,您可以为您的构建将OS_ACTIVITY_MODE环境变量集添加到disable,但这会禁用所有OS模块功能,包括您自己的OSLog和路标等特性,因此不建议这样做。
https://stackoverflow.com/questions/69416675
复制相似问题