如何使用ReplayKit屏幕录制API检测用户录制我的iOS应用程序?

mei*_*sel 5 video-recording ios

Apple发布了我一直在使用的屏幕截图检测的可靠通知,但我还想检测用户是否使用新的ReplayKit API记录我的应用程序.我们可以尝试获取UIScreenDidConnectNotification或测试.mirroredScreen属性以查看是否有任何事情发生,但这些都不可靠,尽管Apple的旧技术说明(https://developer.apple.com/library/content/qa/qa1738 /_index.html)另有说法.我们可以查看状态栏的高度,但这有误报.有没有人为此工作?

小智 2

您是否尝试过注册 RPScreenRecorderDelegate。有一个 screenRecorderDidChangeAvailability 回调。

https://developer.apple.com/documentation/replaykit/rpscreenrecorderdelegate?language=objc