Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当用户收到某些远程推送通知时,我正在尝试闪烁相机灯。问题是如果应用程序在通知到达时处于后台模式,相机灯不会闪烁。但是,如果应用程序位于前台,则一切正常。
即使应用程序在后台,有什么方法可以让它工作吗?
简短的回答:没有
为什么?
在后台禁止使用相机。
由于手电筒是通过 AVCaptureDevice 管理的,因此您无法在后台打开它。
仅当 iPhone 用户在 iPhone 设置中打开 LED 闪光灯以发出警报时,指示灯才会闪烁。
一般-辅助功能-听力(部分)-用于警报的 LED 闪光灯-设置开/关
希望这对您有所帮助。