
- 在Package.swift中注释掉旧的swift-composable-architecture依赖,并添加swift-case-paths依赖。 - 在Podfile中将iOS平台版本更新至16.0,并移除QCloudCOSXML/Transfer依赖,改为使用QCloudCOSXML。 - 更新Podfile.lock以反映依赖变更,确保项目依赖的准确性。 - 新增架构分析需求文档,明确项目架构评估和改进建议。 - 在多个文件中实现async/await语法,提升异步操作的可读性和性能。 - 更新日志输出方法,确保在调试模式下提供一致的调试信息。 - 优化多个视图组件,提升用户体验和代码可维护性。
87 lines
3.6 KiB
Swift
87 lines
3.6 KiB
Swift
import UIKit
|
||
//import NIMSDK
|
||
|
||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) async -> Bool {
|
||
|
||
// 执行数据迁移(从 UserDefaults 到 Keychain)
|
||
DataMigrationManager.performStartupMigration()
|
||
|
||
// 预加载用户信息缓存
|
||
await UserInfoManager.preloadCache()
|
||
|
||
// 开启网络监控
|
||
// NetworkManager.shared.networkStatusChanged = { status in
|
||
// print("🌍 网络状态更新:\(status)")
|
||
// }
|
||
|
||
#if DEBUG
|
||
// 🔍 DES加密已切换到OC版本
|
||
// print("🔐 使用OC版本的DES加密")
|
||
// DESEncryptOCTest.runInAppDelegate()
|
||
|
||
// 网络诊断 - 使用完整的登录参数测试
|
||
// let testURL = URL(string: "http://192.168.10.211:8080/oauth/token")!
|
||
// var request = URLRequest(url: testURL)
|
||
// request.httpMethod = "POST"
|
||
// request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
||
// request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||
// request.setValue("zh-Hant", forHTTPHeaderField: "Accept-Language")
|
||
//
|
||
// // 添加完整的测试参数
|
||
// let testParameters: [String: Any] = [
|
||
// "ispType": "65535",
|
||
// "phone": "3+TbIQYiwIk=",
|
||
// "netType": 2,
|
||
// "channel": "molistar_enterprise",
|
||
// "version": "20.20.61",
|
||
// "pub_sign": "2E7C50AA17A20B32A0023F20B7ECE108",
|
||
// "osVersion": "16.4",
|
||
// "deviceId": "b715b75715e3417c9c70e72bbe502c6c",
|
||
// "grant_type": "password",
|
||
// "os": "iOS",
|
||
// "app": "youmi",
|
||
// "password": "nTW/lEgupIQ=",
|
||
// "client_id": "erban-client",
|
||
// "lang": "zh-Hant-CN",
|
||
// "client_secret": "uyzjdhds",
|
||
// "Accept-Language": "zh-Hant",
|
||
// "model": "iPhone XR",
|
||
// "appVersion": "1.0.0"
|
||
// ]
|
||
//
|
||
// do {
|
||
// let jsonData = try JSONSerialization.data(withJSONObject: testParameters, options: .prettyPrinted)
|
||
// request.httpBody = jsonData
|
||
//
|
||
// print("🛠 原生URLSession登录测试开始")
|
||
// print("📍 测试端点: \(testURL.absoluteString)")
|
||
// print("📦 请求参数: \(String(data: jsonData, encoding: .utf8) ?? "无法解析")")
|
||
//
|
||
// URLSession.shared.dataTask(with: request) { data, response, error in
|
||
// DispatchQueue.main.async {
|
||
// let statusCode = (response as? HTTPURLResponse)?.statusCode ?? -1
|
||
// let responseString = data != nil ? String(data: data!, encoding: .utf8) ?? "无法解析响应" : "无数据"
|
||
//
|
||
// print("""
|
||
// === 网络诊断结果 ===
|
||
// 🔗 URL: \(testURL.absoluteString)
|
||
// 📊 响应状态码: \(statusCode)
|
||
// ❌ 错误信息: \(error?.localizedDescription ?? "无")
|
||
// 📦 原始数据: \(data?.count ?? 0) bytes
|
||
// 📄 响应内容: \(responseString)
|
||
// ==================
|
||
// """)
|
||
// }
|
||
// }.resume()
|
||
// } catch {
|
||
// print("❌ JSON序列化失败: \(error.localizedDescription)")
|
||
// }
|
||
#endif
|
||
|
||
// NIMConfigurationManager.setupNimSDK()
|
||
|
||
return true
|
||
}
|
||
}
|