import UIKit import NIMSDK class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // 开启网络监控 // NetworkManager.shared.networkStatusChanged = { status in // print("🌍 网络状态更新:\(status)") // } #if DEBUG // 网络诊断 let testURL = URL(string: "http://beta.api.molistar.xyz/client/init")! let request = URLRequest(url: testURL) print("🛠 原生URLSession测试开始") URLSession.shared.dataTask(with: request) { data, response, error in print(""" === 网络诊断结果 === 响应状态码: \((response as? HTTPURLResponse)?.statusCode ?? -1) 错误信息: \(error?.localizedDescription ?? "无") 原始数据: \(data?.count ?? 0) bytes ================== """) }.resume() #endif // NIMConfigurationManager.setupNimSDK() return true } }