From 620c34401ab785acf1da1531e0894a511150fb27 Mon Sep 17 00:00:00 2001 From: speakeloudest Date: Sat, 17 Jan 2026 19:18:23 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20iOS=20=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=20VPN=20=E6=97=A0=E6=B3=95=E9=80=9A=E8=BF=87=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=E5=BC=80=E5=90=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Runner/VPN/VPNManager.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ios/Runner/VPN/VPNManager.swift b/ios/Runner/VPN/VPNManager.swift index fbfae96..fb618a5 100755 --- a/ios/Runner/VPN/VPNManager.swift +++ b/ios/Runner/VPN/VPNManager.swift @@ -194,7 +194,9 @@ class VPNManager: ObservableObject { func connect(with config: String, disableMemoryLimit: Bool = false) async throws { await set(upload: 0, download: 0) - guard state == .disconnected else { return } + // 修复:放宽前置条件,允许在非 connected 状态下连接 + // 只要不是已连接状态,都允许尝试连接(包括 invalid、reasserting 等状态) + guard state != .connected else { return } do { try await enableVPNManager() try manager.connection.startVPNTunnel(options: [