简体   繁体   English

如何防止ios11中的屏幕记录

[英]how to prevent screen record in ios11

由于某些原因,我们的APP不希望人们记录屏幕,但在ios11中一个新功能可以让用户在那里录制iphone屏幕,所以是否有一个API或通知指示我用户正在录制现在非常感谢你

You can detect if the screen is being recorded with: 您可以检测屏幕是否正在录制:

UIScreen.main.isCaptured
// True if this screen is being captured (e.g. recorded, AirPlayed, mirrored, etc.)

You can't prevent it using project settings, but you could use a modal or something to request the user to disable it. 您无法使用项目设置阻止它,但您可以使用模式或其他东西来请求用户禁用它。 Not sure how that might workout with your AppStore submission. 不确定如何使用您的AppStore提交进行锻炼。

You can use kvo observe UIScreenCapturedDidChangeNotification in iOS 11 like this 您可以在iOS 11中使用kvo观察UIScreenCapturedDidChangeNotification

NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
    [[NSNotificationCenter defaultCenter] addObserverForName:UIScreenCapturedDidChangeNotification object:nil queue:mainQueue usingBlock:^(NSNotification * _Nonnull note) { 
 //code you want execute
}];

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

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