how to prevent screen record in ios11

送分小仙女□ 提交于 2019-12-05 16:03:46

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.

李国立

You can use kvo observe UIScreenCapturedDidChangeNotification in iOS 11 like this

NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
    [[NSNotificationCenter defaultCenter] addObserverForName:UIScreenCapturedDidChangeNotification object:nil queue:mainQueue usingBlock:^(NSNotification * _Nonnull note) { 
 //code you want execute
}];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!