Giter Club home page Giter Club logo

bkpasscodeview's Introduction

BKPasscodeView

  • iOS7 style passcode view. Supports create, change and authenticate password.
  • Customizable lock policy for too many failure attempts.
  • Customizable passcode digit appearance.
  • Shows lock scrren when application entered background state. Use BKPasscodeLockScreenManager
  • You can authenticate passcode asynchronously. (e.g. using API to authenticate passcode)
  • Supports Touch ID API in iOS 8.

Screenshots

Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot

Classes

Class Description
BKPasscodeField A custom control that conforms UIKeyInput. When it become first responder keyboard will be displayed to input passcode.
BKPasscodeInputView A view that supports numeric or normal(ASCII) passcode. This view can display title, message and error message. You can customize label appearances by overriding static methods.
BKShiftingPasscodeInputView A view that make a transition between two BKPasscodeInputView. You can shift passcode views forward and backward.
BKPasscodeViewController A view controller that supports create, change and authenticate passcode.
BKPasscodeLockScreenManager A manager that shows lock screen when application entered background state. You can activate with activateWithDelegate: method.
BKTouchIDManager A manager that save, load and delete keychain item. It saves passcode to keychain and item cannot be accessed without fingerprint.

Podfile

platform :ios
pod 'BKPasscodeView', '~> 0.1.2'

Example

Presenting Passcode View Controller

BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nil bundle:nil];
viewController.delegate = self;
viewController.type = BKPasscodeViewControllerNewPasscodeType;
// viewController.type = BKPasscodeViewControllerChangePasscodeType;    // for change
// viewController.type = BKPasscodeViewControllerCheckPasscodeType;   // for authentication

viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
// viewController.passcodeStyle = BKPasscodeInputViewNormalPasscodeStyle;    // for ASCII style passcode.

// To supports Touch ID feature, set BKTouchIDManager instance to view controller.
// It only supports iOS 8 or greater.
viewController.touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName:@"<# your keychain service name #>"];
viewController.touchIDManager.promptText = @"Scan fingerprint to authenticate";   // You can set prompt text.

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self presentViewController:navController animated:YES completion:nil];

Authenticate with Touch ID without presenting passcode view controller

BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nil bundle:nil];
viewController.delegate = self;
viewController.type = BKPasscodeViewControllerCheckPasscodeType;   // for authentication
viewController.passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;

// To supports Touch ID feature, set BKTouchIDManager instance to view controller.
// It only supports iOS 8 or greater.
viewController.touchIDManager = [[BKTouchIDManager alloc] initWithKeychainServiceName:@"<# your keychain service name #>"];
viewController.touchIDManager.promptText = @"Scan fingerprint to authenticate";   // You can set prompt text.

// Show Touch ID user interface
[viewController startTouchIDAuthenticationIfPossible:^(BOOL prompted) {

  // If Touch ID is unavailable or disabled, present passcode view controller for manual input.
  if (NO == prompted) {
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
    [self presentViewController:navController animated:YES completion:nil];
  }
}];

Showing Lock Screen

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // ...
  
  [[BKPasscodeLockScreenManager sharedManager] setDelegate:self];
  
  // ...
  return YES;
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
  // ...
  // show passcode view controller when enter background. Screen will be obscured from here.
  [[BKPasscodeLockScreenManager sharedManager] showLockScreen:NO];
}

- (BOOL)lockScreenManagerShouldShowLockScreen:(BKPasscodeLockScreenManager *)aManager
{
  return YES;   // return NO if you don't want to present lock screen.
}

- (UIViewController *)lockScreenManagerPasscodeViewController:(BKPasscodeLockScreenManager *)aManager
{
  BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nil bundle:nil];
  viewController.type = BKPasscodeViewControllerCheckPasscodeType;
  viewController.delegate = <# set delegate to authenticate passcode #>;
  
  UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
  return navController;
}

bkpasscodeview's People

Contributors

ajjames avatar bkook avatar lucien avatar zhukn1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bkpasscodeview's Issues

App reopens when touchid is enabled

Steps to reproduce:

  1. Enable touch id
  2. Enter to the foreground mode
  3. Double click on home button
  4. Close app (with a swipe)
  5. Touchid will relaunch app

- (void)viewWillDisappear:(BOOL)animated

I use BKPasscodeView with a program that a function : -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation, in some cases the [self.passcodeInputView becomeFirstResponder]; in viewWillAppear does not work and the keyboard does not appear, by including the code in - (void)viewDidAppear:(BOOL)animated the problem is solved ...

The problem its @Property (nonatomic, strong) BKPasscodeInput View *passcodeInputView; this is declared in @interface BKPasscodeViewController() (.m) and not visible in my in my derived class. then in my derived class i solved it is not elegant but it works :

- (void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [super viewWillAppear:animated];
}

bye m.

Plase info

Hi :-) I'd like to be able to enter text as in the image for the description if required by the context ...

passcode_04

Landscape

I'm trying to use the simulator iphone 5/6 but in landscape mode the code disappears. Please check. Thanks!

applicationDidEnterBackground and QLPreviewController

Hi! i use QLPreviewController for view image and document but with BKPassword in background i can still see the image (attach image example with iOS 7).

- (void)applicationDidEnterBackground:(UIApplication *)application
{
     [[BKPasscodeLockScreenManager sharedManager] showLockScreen:NO];
}

img_6435

Crash on iOS 7.x

dyld: Library not loaded: /System/Library/Frameworks/LocalAuthentication.framework/LocalAuthentication
  Referenced from: /var/mobile/Applications/839D826E-79C0-4100-96F7-2D6768CC6FNM/Testing.app/Testing
  Reason: image not found

Because LocalAuthentication.framework is available from iOS 8.0. If iOS < 8.0, self-adaption not supports Touch ID API.

0.2.3 tag for cocoapods?

When will you be making a new version for cocoa pods so I can get the latest changes?
Thanks again!
AJ

Unable to submit to iTC when using BKPasscodeView

Uploading a build to TestFlight fails caused by the following issue:

[09:57:41]: [Transporter Error Output]: ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/MainViewController.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
[09:57:41]: [Transporter Error Output]: ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/main.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
[09:57:41]: [Transporter Error Output]: ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/AppDelegate.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
[09:57:41]: [Transporter Error Output]: ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/BKCustomPasscodeViewController.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
[09:57:41]: Transporter transfer failed.
[09:57:41]:
[09:57:41]: ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/MainViewController.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/main.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/AppDelegate.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/BKCustomPasscodeViewController.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
[09:57:41]: ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/MainViewController.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/main.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/AppDelegate.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/BKCustomPasscodeViewController.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
Return status of iTunes Transporter was 1: ERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/MainViewController.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBund\nERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/main.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle \nERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/AppDelegate.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the \nERROR ITMS-90171: "Invalid Bundle Structure - The binary file '[redacted].app/Frameworks/BKPasscodeView.framework/MyResources.bundle/BKCustomPasscodeViewController.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure."
The call to the iTMSTransporter completed with a non-zero exit status: 1. This indicates a failure.

Contents of Podfile.lock:

- BKPasscodeView (0.2.3):
    - AFViewShaker (~> 0.0)
[...]
SPEC CHECKSUMS:
  [...]
  BKPasscodeView: 4dd27931ad4e5938e9967fdb260f6e166fa82632

App rejected when using BKPasscodeView

Hi,

Is your control free from Private API? I have tried to use your code in my app but rejected by Apple because the Touch ID API that you implemented uses some Private API. Can you clarify this?

Delegate

Hi, in my App i have the appDelegate with :

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    ...
    // delegate per il passcode
    [[BKPasscodeLockScreenManager sharedManager] setDelegate:self];
    ..

self.viewController = [[UIViewController alloc] init];
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIStoryboard *mainstoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

if ([TWSUtility datiLoginMemorizzati] && [passcode length]) {
    self.viewController = [mainstoryboard instantiateViewControllerWithIdentifier:@"TSTabBarViewController"];
} else {
    self.viewController = [mainstoryboard instantiateViewControllerWithIdentifier:@"TSLoginSetupVC"];
}

self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];

...
}

  • (UIViewController *)lockScreenManagerPasscodeViewController:(BKPasscodeLockScreenManager *)aManager
    {
    BKPasscodeViewController *viewController = [[BKPasscodeViewController alloc] initWithNibName:nil bundle:nil];
    viewController.type = BKPasscodeViewControllerCheckPasscodeType;
    viewController.delegate = self;

error :AppDelegate.m:137:29: Assigning to 'id' from incompatible type 'UIViewController *'

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
return navController;

}

How can i handle this problem without changing my didFinishLaunchingWithOptions ?

thanks !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.