问题描述
我的 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.
我的问题是是否可以显示一次弹出窗口,即仅在第一次启动后(fitbit 应用程序这样做.我也想知道是否可以更改弹出窗口的语言.
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 * manager
.
In my .h file, I have a CBCentralManager * manager
.
在我的 .m 文件中:
In my .m file:
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 则禁用警告对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!