【问题标题】:How do I turn on Bluetooth in react-native if NSURL URLWithString:@"App-Prefs:root=Bluetooth" is no longer accepted?如果 NSURL URLWithString:@"App-Prefs:root=Bluetooth" 不再被接受,如何在 react-native 中打开蓝牙?
【发布时间】:2019-05-04 07:24:36
【问题描述】:

我最近更新了一个 react-native 应用的 iOS 版本。我收到一封拒绝信,说明“app-prefs:root=bluetooth”是不允许的。

我查看了代码,发现那条线负责打开蓝牙。如果我不再能够使用 app-prefs:root=bluetooth,我将如何开启蓝牙?

完整的代码如下所示:

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

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

【问题讨论】:

    标签: ios objective-c bluetooth app-store


    【解决方案1】:
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    

    【讨论】:

      猜你喜欢
      • 2021-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      相关资源
      最近更新 更多