我刚刚将 XCode 更新到版本 15,遇到此错误(仅限 17 以下的 iOS 版本)\xc2\xa0
\nThread 1: EXC_BAD_ACCESS (code=1, address=0x0)\nRun Code Online (Sandbox Code Playgroud)\n显示此错误的代码(PathMonitorConectivityProvider.swift):
\n当我从 XCode 运行代码时(iOS 设备版本是 iOS 16.4),以下代码中出现异常。
\nimport Foundation\nimport Network\n\n@available(iOS 12, *)\npublic class PathMonitorConnectivityProvider: NSObject, ConnectivityProvider {\n\n private let queue = DispatchQueue.global(qos: .background)\n\n private var _pathMonitor: NWPathMonitor?\n\n public var currentConnectivityType: ConnectivityType {\n let path = ensurePathMonitor().currentPath\n // .satisfied means that the network is available\n if path.status == .satisfied {\n if path.usesInterfaceType(.wifi) {\n return .wifi\n } else if path.usesInterfaceType(.cellular) {\n return .cellular\n } else …Run Code Online (Sandbox Code Playgroud)