Skip to content

ninu/ShotBlocker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShotBlocker

Detecting iOS screenshots ala Snapchat and Facebook Poke.

Current technique is to poll the user's camera roll and check for new screenshot-esque images; if you would like to add another technique, definitely submit a pull-request!

Usage

[[ShotBlocker sharedManager] detectScreenshotWithImageBlock:^(UIImage *screenshot) {
    NSLog(@"Screenshot: %@", screenshot);
}];

// Later on...

[[ShotBlocker sharedManager] stopDetectingScreenshots];

Also available are:

  • detectScreenshotWithBlock:^()
  • detectScreenshotWithBlock:^() andErrorBlock:^(NSError * error){}
  • detectScreenshotWithImageBlock:^(UIImage *screenshot) andErrorBlock:^(NSError * error){}

The NSError will occur if the user denies your app access to their photos.

Installation

pod 'ShotBlocker'
#import <ShotBlocker/ShotBlocker.h>

Xcode

  1. Add ShotBlocker as a git submodule. Here's how to add it as a submodule:

    $ cd rootOfYourGitRepo $ git submodule add https://github.com/clayallsopp/ShotBlocker.git Vendor/ShotBlocker $ git submodule update --init --recursive

  2. Add ShotBlocker/ShotBlocker.h and ShotBlocker/ShotBlocker.m to your project, but don't copy the files (so the location is relative).

  3. Add AssetsLibrary.framework to your project

#import "ShotBlocker.h"

Contact

Clay Allsopp @clayallsopp

About

Detecting iOS screenshots ala Snapchat and Facebook Poke

Resources

License

Stars

Watchers

Forks

Packages

No packages published