简体   繁体   English

蓝牙低能耗iOS应用

[英]BlueTooth Low Energy iOS App

I am connecting mac as a "Centerl" with my iPhone as a "Peripheral" using BlueTooth Low Energy.Both Peripheral and central connected successfully and work in both mode foreground and background. 我使用蓝牙低功耗技术将Mac作为“ Centerl”与iPhone作为“ Peripheral”进行连接。外围设备和中央设备均已成功连接,并且可以在前景模式和背景模式下工作。

But my problem is that during background mode,if i manually on or off the bluetooth of my device, i dectected my blue tooth is off or on during background mode , but Central not connected with peripheral anymore during background mode. 但是我的问题是,在后台模式下,如果我手动打开或关闭设备的蓝牙,我确定在后台模式下蓝牙处于关闭或打开状态,但是Central在后台模式下不再与外围设备连接。

You need to enable Background Modes for location update and for bluetooth low energy for your project target. 您需要为项目目标启用“ 背景模式”以进行位置更新和低功耗蓝牙。

Select Xcode project properties >> project target >> Go to Capabilities >> Background Modes 选择Xcode项目属性>>项目目标>>转到功能>>后台模式

在此处输入图片说明

As shown in above image check mark below properties: 如上图所示,选中以下属性:

  1. Location Updates 位置更新
  2. Uses Bluetooth LE accessories 使用蓝牙LE配件

Edit: 编辑:

Check device settings: 检查设备设置:

  1. Check whether enable the background app refresh in Settings -> General -> Background App Refresh 在设置->常规->后台应用刷新中检查是否启用后台应用刷新
  2. Check whether enable the location service in Settings -> Privacy -> Location Services 在设置->隐私->位置服务中检查是否启用位置服务
  3. Check whether enable the WiFi, even there not wifi signal. 检查是否启用WiFi,即使没有wifi信号也是如此。

If all above is enabled, but still not working, Try to reset the network settings in Settings -> General -> Reset or reboot the device. 如果以上所有功能均已启用,但仍不起作用,请尝试在“设置”->“常规”->“重置或重启设备”中重置网络设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM