2 // CheckV12DevEnabled.m
5 // Created by Wouter de Groot on 2018-10-20.
8 // TODO: remove me when keychain backup is enabled for all
10 #include "CheckV12DevEnabled.h"
14 #import <Foundation/Foundation.h>
15 #import <dispatch/dispatch.h>
17 static int realCheckV12DevEnabled() {
18 static bool enabled = NO;
19 static dispatch_once_t onceToken;
20 dispatch_once(&onceToken, ^{
21 NSUserDefaults* defaults = [[NSUserDefaults alloc] initWithSuiteName:@"com.apple.security"];
22 enabled = [defaults boolForKey:@"enableKeychainBackupDevelopment"];
24 return enabled ? 1 : 0;
27 int (*checkV12DevEnabled)(void) = realCheckV12DevEnabled;
29 void resetCheckV12DevEnabled(void) {
30 checkV12DevEnabled = realCheckV12DevEnabled;