• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

iOS 在未运行状态下从 BLE 获取数据

[复制链接]
菜鸟教程小白 发表于 2022-12-11 21:45:08 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我在前台和后台状态下成功地从 BLE 获取数据。并且也调用了核心蓝牙框架各自的委托(delegate)方法。

用户强制退出应用程序后,我想要来自 BLE 设备的数据。是否可以在非运行状态下从 BLE 获取数据?或者有没有像 iBeacon 这样在非运行状态下调用的方法?



Best Answer-推荐答案


除非使用 iBeacon BLE 设备,否则我认为这是不可能的。如 Understanding When Your App Gets Launched into the Background 中所述部分:

Apps that support background execution may be relaunched by the system to handle incoming events. If an app is terminated for any reason other than the user force quitting it, the system launches the app when one of the following events happens:

For Bluetooth apps:

  • An app acting in the central role receives data from a connected peripheral.
  • An app acting in the peripheral role receives commands from a connected central.

In most cases, the system does not relaunch apps after they are force quit by the user. One exception is location apps, which in iOS 8 and later are relaunched after being force quit by the user. In other cases, though, the user must launch the app explicitly or reboot the device before the app can be launched automatically into the background by the system. When password protection is enabled on the device, the system does not launch an app in the background before the user first unlocks the device.

所以当应用程序被用户而不是系统强制退出时,这意味着用户不希望应用程序在后台运行并且应用程序不会重新启动并且不会调用委托(delegate).

但如果应用程序被系统杀死,iOS 将在调用委托(delegate)时再次处理唤醒它。

关于iOS 在未运行状态下从 BLE 获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54103360/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap