fixed ios wifi part support. retry 5.
This commit is contained in:
1 parent
87ba9a928b
commit
0504d4058a
4 files changed
+21
-11
No files matched your search
@@ -103,7 +103,7 @@ WiFi options:
|
||||
- `ssid`:必填
|
||||
- `password`:开放网络可省略
|
||||
- `security`:`open`、`wep`、`wpa2`、`wpa3`,默认按是否存在 password 推断为 `open` 或 `wpa2`
|
||||
- `hiddenSsid`:可选;Android 支持隐藏 SSID;iOS 13+ 会设置 `NEHotspotConfiguration.hidden`
|
||||
- `hiddenSsid`:可选;Android 支持隐藏 SSID;iOS 15+ 会设置 `NEHotspotConfiguration.hidden`
|
||||
- `bssid`:可选,仅 Android 10+ 临时连接使用
|
||||
- `joinOnce`:可选,仅 iOS;`connectWifi` 默认 `true`,`saveWifi` 默认 `false`
|
||||
|
||||
@@ -210,7 +210,8 @@ Android WiFi:
|
||||
|
||||
iOS WiFi:
|
||||
|
||||
- 使用 `NEHotspotConfiguration`。
|
||||
- 使用 `NEHotspotConfiguration`,当前插件 WiFi 功能要求 iOS 15+。
|
||||
- 插件将 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 流程。
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bluememe-utils",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"description": "Cordova utilities for WiFi, Firebase Cloud Messaging, and biometric unlock for OutSystems 11 apps.",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
+3
-1
@@ -2,7 +2,7 @@
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="bluememe-utils"
|
||||
version="0.1.4">
|
||||
version="0.1.5">
|
||||
<name>bluememe-utils</name>
|
||||
<description>Cordova utilities for WiFi, Firebase Cloud Messaging, and biometric unlock.</description>
|
||||
<license>MIT</license>
|
||||
@@ -72,6 +72,8 @@
|
||||
</platform>
|
||||
|
||||
<platform name="ios">
|
||||
<preference name="deployment-target" value="15.0" />
|
||||
|
||||
<config-file target="config.xml" parent="/*">
|
||||
<feature name="BluememeUtils">
|
||||
<param name="ios-package" value="CDVBluememeUtils" />
|
||||
|
||||
@@ -75,11 +75,11 @@ static NSString * const BluememeDeviceKeyDefaultsKey = @"bluememe_utils_device_k
|
||||
return;
|
||||
}
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
[[NEHotspotConfigurationManager sharedManager] removeConfigurationForSSID:ssid];
|
||||
[self sendSuccessForCommand:command dictionary:@{@"ssid": ssid, @"removed": @YES}];
|
||||
} else {
|
||||
[self sendErrorForCommand:command code:@"UNSUPPORTED_IOS_VERSION" message:@"WiFi configuration requires iOS 11 or newer."];
|
||||
[self sendErrorForCommand:command code:@"UNSUPPORTED_IOS_VERSION" message:@"WiFi configuration requires iOS 15 or newer."];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,18 +316,17 @@ static NSString * const BluememeDeviceKeyDefaultsKey = @"bluememe_utils_device_k
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
NEHotspotConfiguration *configuration = nil;
|
||||
if (isOpen) {
|
||||
configuration = [[NEHotspotConfiguration alloc] initWithSSID:ssid];
|
||||
} else {
|
||||
configuration = [[NEHotspotConfiguration alloc] initWithSSID:ssid passphrase:password isWEP:isWep];
|
||||
}
|
||||
if (@available(iOS 13.0, *)) {
|
||||
configuration.hidden = hiddenSsid;
|
||||
}
|
||||
configuration.joinOnce = joinOnce;
|
||||
|
||||
void (^applyConfiguration)(void) = ^{
|
||||
[[NEHotspotConfigurationManager sharedManager] applyConfiguration:configuration completionHandler:^(NSError *error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (error != nil && error.code != NEHotspotConfigurationErrorAlreadyAssociated) {
|
||||
@@ -336,7 +335,8 @@ static NSString * const BluememeDeviceKeyDefaultsKey = @"bluememe_utils_device_k
|
||||
@"security": security,
|
||||
@"passwordLength": @(password.length),
|
||||
@"joinOnce": @(joinOnce),
|
||||
@"hiddenSsid": @(hiddenSsid)
|
||||
@"hiddenSsid": @(hiddenSsid),
|
||||
@"minimumIos": @"15.0"
|
||||
};
|
||||
[self sendWifiApplyErrorForCommand:command error:error context:context];
|
||||
return;
|
||||
@@ -351,8 +351,15 @@ static NSString * const BluememeDeviceKeyDefaultsKey = @"bluememe_utils_device_k
|
||||
[self sendSuccessForCommand:command dictionary:result];
|
||||
});
|
||||
}];
|
||||
};
|
||||
|
||||
if ([NSThread isMainThread]) {
|
||||
applyConfiguration();
|
||||
} else {
|
||||
[self sendErrorForCommand:command code:@"UNSUPPORTED_IOS_VERSION" message:@"WiFi configuration requires iOS 11 or newer."];
|
||||
dispatch_async(dispatch_get_main_queue(), applyConfiguration);
|
||||
}
|
||||
} else {
|
||||
[self sendErrorForCommand:command code:@"UNSUPPORTED_IOS_VERSION" message:@"WiFi configuration requires iOS 15 or newer."];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user