如果蓝牙已关闭iOS,请禁用警告对话框 [英] Disable Warning Dialog if Bluetooth is powered off iOS

查看:269
本文介绍了如果蓝牙已关闭iOS,请禁用警告对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ios应用程序使用蓝牙连接到附件。如果未启用蓝牙,则会出现一个弹出窗口,要求我激活。

My ios application uses bluetooth to connect to an accessory. If Bluetooth is not enabled, a popup appears asking me to activate.

我注意到每次运行应用程序时都会出现弹出窗口。

I noticed that popup appears every time I run the application.

My问题是是否可以显示一次弹出窗口,即仅在首次启动后显示( fitbit app这样做。我也想知道是否可以更改弹出窗口的语言。

My question is whether it is possible to display the popup once, ie only after the first launch (fitbit app do that. I also want to know if it is possible to change the language of the popup.

我的应用程序适用于iOS7和iOS6

My application is for iOS7 and iOS6

如果我们无法更改语言,有没有办法禁用此弹出窗口,那么我将开发我自己的观点(弹出窗口)与本地化系统?

If we can't change the langage, is there a way to disable this popup then i will develop my own view (popup) with localized system ?

非常感谢你!

推荐答案

我得到了苹果开发者的以下回复:
在iOS7中, CBCentralManagerOptionShowPowerAlertKey 选项允许您禁用此警报。

I got the following response from an apple developer : In iOS7, the CBCentralManagerOptionShowPowerAlertKey option lets you disable this alert.

如果您有 CBCentralManager ,那么当您初始化它时,您可以使用方法 - [CBCentralManager initWithDelegate:queue:options]

If you have a CBCentralManager, then when you initialise it, you can use the method -[CBCentralManager initWithDelegate:queue:options]

在我的.h文件中,我有一个 CBCentralManager *经理

In my .h file, I have a CBCentralManager * manager.

在我的.m文件:

NSDictionary *options = @{CBCentralManagerOptionShowPowerAlertKey: @NO};

_manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:options];

[_manager scanForPeripheralsWithServices:nil options:options];

使用此代码,警告不再出现。我希望有所帮助!

With this code, the warning no longer appears. I hope that helps!

这篇关于如果蓝牙已关闭iOS,请禁用警告对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆