
新增Package.swift和Package.resolved文件以支持Swift Package管理,创建API相关文件(API.swift、APICaller.swift、APIConstants.swift、APIEndpoints.swift、APIService.swift、APILogger.swift、APIModels.swift、Integration-Guide.md)以实现API请求管理和网络交互功能,增强项目的功能性和可扩展性。同时更新.gitignore以排除构建文件和临时文件。
35 lines
1.2 KiB
Swift
35 lines
1.2 KiB
Swift
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
|
||
}
|
||
}
|