如果不再接受 NSURL URLWithString:@"App-Prefs:root=Bluetooth",我如何在 react-native 中打开蓝牙?

How do I turn on Bluetooth in react-native if NSURL URLWithString:@"App-Prefs:root=Bluetooth" is no longer accepted?

我最近更新了 iOS 版本的 react-native 应用程序。我收到一封拒绝信,指出 "app-prefs:root=bluetooth" 是不允许的。

看了下代码,发现那一行是负责开启蓝牙的。如果我无法再使用 app-prefs:root=bluetooth,我该如何打开蓝牙?

完整代码如下所示:

RCT_EXPORT_METHOD(turnOnBluetooth:(BOOL)openSettings)
{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Bluetooth"]];
}

免责声明:我接管了这个项目,并没有编写任何本机模块。我在使用原生 modules/objective C 方面的经验也非常有限。

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];