zoukankan      html  css  js  c++  java
  • 截屏监测

    在iOS开发的一些业务场景中,可能有一些敏感信息(如付款的二维码等),我们不希望被随意传播。应用内禁止截屏,可以一定程度上,提高敏感信息被传播的门槛(可能需要另外一台手机拍照,并手机间传输)。

    然而,由于iOS系统的特殊性,常规方法无法完全禁止用户截屏落地成系统图片。目前,网上的解决方案,主要有两种:

      1. 监听截屏后通知(UIApplicationUserDidTakeScreenshotNotification),并进行提示。
      1. 让用户安装禁用屏幕快照和屏幕录制的配置文件。

    前者无法禁止截屏内容落地,后者阉割了手机功能,导致其他应用也无法截屏。二者均不能满足需求。

    前者使用方法

    在AppDelegate.m页面里面添加下面通知和执行方法即可。

    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    {
      
    
    #ifdef ADD_SHOT_SCREEN_WARNING
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDidTakeScreenshotNotification:) name:UIApplicationUserDidTakeScreenshotNotification object:nil];
    
    #endif
    
    }
    - (void)userDidTakeScreenshotNotification:(NSNotification *)notifataion{
        UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"为确保信息安全,本app不允许截屏。敬请自觉遵守。" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
        [alertView show];
    }

    截屏只可监测,不能阻止

  • 相关阅读:
    java数据库连接池
    TCP长连接服务的Java实现
    一种简单JDBC数据库连接池的实现
    ProFtpd快速指南
    vsftpd安装
    IIS启动失败【发生意外错误 0x8ffe2740】解决办法
    eclipse+myeclipse+tomcat配置web开发
    数据库连接池技术浅析
    论JSP数据库连接池的必要性
    ProFTPD使用
  • 原文地址:https://www.cnblogs.com/OIMM/p/11696653.html
Copyright © 2011-2022 走看看