diff --git a/RNKeychainManager/RNKeychainManager.m b/RNKeychainManager/RNKeychainManager.m index 98e45fe7..09152151 100644 --- a/RNKeychainManager/RNKeychainManager.m +++ b/RNKeychainManager/RNKeychainManager.m @@ -12,7 +12,9 @@ #import #import +#if TARGET_OS_IOS #import +#endif #import @implementation RNKeychainManager @@ -152,6 +154,7 @@ CFStringRef accessibleValue(NSDictionary *options) #define kBiometryTypeTouchID @"TouchID" #define kBiometryTypeFaceID @"FaceID" +#if TARGET_OS_IOS LAPolicy authPolicy(NSDictionary *options) { if (options && options[kAuthenticationType]) { @@ -161,6 +164,7 @@ LAPolicy authPolicy(NSDictionary *options) } return LAPolicyDeviceOwnerAuthentication; } +#endif SecAccessControlCreateFlags accessControlValue(NSDictionary *options) { @@ -203,10 +207,12 @@ - (void)insertKeychainEntry:(NSDictionary *)attributes if (accessControl) { NSError *aerr = nil; +#if TARGET_OS_IOS BOOL canAuthenticate = [[LAContext new] canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:&aerr]; if (aerr || !canAuthenticate) { return rejectWithError(reject, aerr); } +#endif CFErrorRef error = NULL; SecAccessControlRef sacRef = SecAccessControlCreateWithFlags(kCFAllocatorDefault,