From e97f17410bb0c4ad63ca4ba1ad5dcf2336a89a86 Mon Sep 17 00:00:00 2001 From: aria Date: Thu, 23 Apr 2026 11:29:46 +0900 Subject: [PATCH] fixed ios wifi part support. retry 7. --- README.md | 2 +- package.json | 2 +- plugin.xml | 2 +- src/ios/CDVBluememeUtils.m | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5919779..b506c21 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,7 @@ iOS WiFi: - 插件将 iOS deployment target 设置为 `15.0`;如果宿主 App 或构建平台覆盖该值,需要在宿主配置中同步设置 iOS 最低版本为 15.0 或更高。 - 插件会向 Cordova iOS entitlements 写入 `com.apple.developer.networking.HotspotConfiguration`,但仍必须在 Apple Developer App ID 中开启 `Hotspot Configuration` capability,并使用包含该 capability 的 provisioning profile 重新构建。 - 如果 iOS 返回 `NEHotspotConfigurationErrorDomain` code `8` / `internal error`,优先检查 App ID、entitlements、provisioning profile 是否都包含 `Hotspot Configuration`,并确认是在真机前台运行,不是在模拟器中测试。 -- iOS 的 `NEHotspotConfiguration` password initializer 公开支持 WEP/WPA/WPA2 Personal。WPA2/WPA3 mixed 通常应先按 `security: "wpa2"` 测试;如果 WPA2-only 可用但 mixed 不可用,需要调整热点兼容性配置或改用配置描述文件/MDM 流程。 +- iOS 的 `NEHotspotConfiguration` password initializer 公开支持 WEP/WPA/WPA2 Personal,不提供 WPA3 Personal 参数。iOS 传入 `security` 包含 `wpa3` 时会返回 `UNSUPPORTED_WIFI_SECURITY`。WPA2/WPA3 mixed 通常只能按 `security: "wpa2"` 尝试;如果仍失败,需要用户手动加入,或改用配置描述文件/MDM 流程。 - iOS 不提供第三方 App 断开当前 WiFi 的公开 API,因此 `disconnectWifi` 在 iOS 返回错误。 Firebase: diff --git a/package.json b/package.json index 819c58b..c40b8d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bluememe-utils", - "version": "0.1.6", + "version": "0.1.7", "description": "Cordova utilities for WiFi, Firebase Cloud Messaging, and biometric unlock for OutSystems 11 apps.", "license": "MIT", "files": [ diff --git a/plugin.xml b/plugin.xml index b17c595..0b621fa 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.1.7"> bluememe-utils Cordova utilities for WiFi, Firebase Cloud Messaging, and biometric unlock. MIT diff --git a/src/ios/CDVBluememeUtils.m b/src/ios/CDVBluememeUtils.m index 4451e39..7bb6597 100644 --- a/src/ios/CDVBluememeUtils.m +++ b/src/ios/CDVBluememeUtils.m @@ -290,6 +290,7 @@ static NSString * const BluememeDeviceKeyDefaultsKey = @"bluememe_utils_device_k security = password.length == 0 ? @"open" : @"wpa2"; } BOOL isOpen = [security isEqualToString:@"open"] || [security isEqualToString:@"none"]; + BOOL isWpa3 = [security containsString:@"wpa3"] || [security isEqualToString:@"sae"]; BOOL isWep = [security isEqualToString:@"wep"] || [self boolFromDictionary:options key:@"isWep" defaultValue:NO]; BOOL joinOnce = [self boolFromDictionary:options key:@"joinOnce" defaultValue:defaultJoinOnce]; BOOL hiddenSsid = [self boolFromDictionary:options key:@"hiddenSsid" defaultValue:NO]; @@ -299,6 +300,19 @@ static NSString * const BluememeDeviceKeyDefaultsKey = @"bluememe_utils_device_k return; } + if (isWpa3) { + [self sendErrorForCommand:command + code:@"UNSUPPORTED_WIFI_SECURITY" + message:@"iOS NEHotspotConfiguration does not support WPA3 Personal via the app WiFi configuration API. Use WPA/WPA2 Personal with security \"wpa2\", or use a WiFi configuration profile/MDM flow." + details:@{ + @"ssid": ssid, + @"security": security, + @"minimumIos": @"15.0", + @"nativeApi": @"NEHotspotConfiguration" + }]; + return; + } + if (!isOpen && password.length == 0) { [self sendErrorForCommand:command code:@"INVALID_WIFI_OPTIONS" message:@"password is required for secured WiFi networks."]; return;