Xcode Objective-C ShotBlocker:如何检测和阻止屏幕截图
Xcode Objective-C ShotBlocker: How to detect and block screenshots
在我创建的应用程序中,您不能截屏。我想知道您如何检测和阻止屏幕截图。我发现您可以使用 ShotBlocker 做到这一点,但我不知道如何做。有谁知道如何检测和阻止 Objective-C 中的屏幕截图?
无法在 iOS 上屏蔽屏幕截图。至少你可以检测到这样截屏后:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenshotDetected) name:UIApplicationUserDidTakeScreenshotNotification object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationUserDidTakeScreenshotNotification object:nil];
}
- (void)screenshotDetected {
UIAlertView * alert =[[UIAlertView alloc ] initWithTitle:@"Hey!"
message:@"You're not allowed to do that"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles: nil];
[alert addButtonWithTitle:@"GO"];
[alert show];
}
在我创建的应用程序中,您不能截屏。我想知道您如何检测和阻止屏幕截图。我发现您可以使用 ShotBlocker 做到这一点,但我不知道如何做。有谁知道如何检测和阻止 Objective-C 中的屏幕截图?
无法在 iOS 上屏蔽屏幕截图。至少你可以检测到这样截屏后:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenshotDetected) name:UIApplicationUserDidTakeScreenshotNotification object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationUserDidTakeScreenshotNotification object:nil];
}
- (void)screenshotDetected {
UIAlertView * alert =[[UIAlertView alloc ] initWithTitle:@"Hey!"
message:@"You're not allowed to do that"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles: nil];
[alert addButtonWithTitle:@"GO"];
[alert show];
}