diff --git a/Sources/SSKeychainQuery.h b/Sources/SSKeychainQuery.h index 1068eeb..7f8ebc2 100644 --- a/Sources/SSKeychainQuery.h +++ b/Sources/SSKeychainQuery.h @@ -19,6 +19,11 @@ #define SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE 1 #endif +#if __IPHONE_3_0 || __MAC_10_9 + // Keychain access group available at compile time + #define SSKEYCHAIN_ACCESS_GROUP_AVAILABLE 1 +#endif + #ifdef SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE typedef NS_ENUM(NSUInteger, SSKeychainQuerySynchronizationMode) { SSKeychainQuerySynchronizationModeAny, @@ -41,7 +46,7 @@ typedef NS_ENUM(NSUInteger, SSKeychainQuerySynchronizationMode) { /** kSecAttrLabel */ @property (nonatomic, copy) NSString *label; -#if __IPHONE_3_0 && TARGET_OS_IPHONE +#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE /** kSecAttrAccessGroup (only used on iOS) */ @property (nonatomic, copy) NSString *accessGroup; #endif diff --git a/Sources/SSKeychainQuery.m b/Sources/SSKeychainQuery.m index f37e079..126889c 100644 --- a/Sources/SSKeychainQuery.m +++ b/Sources/SSKeychainQuery.m @@ -16,7 +16,7 @@ @implementation SSKeychainQuery @synthesize label = _label; @synthesize passwordData = _passwordData; -#if __IPHONE_3_0 && TARGET_OS_IPHONE +#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE @synthesize accessGroup = _accessGroup; #endif @@ -203,11 +203,13 @@ - (NSMutableDictionary *)query { [dictionary setObject:self.account forKey:(__bridge id)kSecAttrAccount]; } -#if __IPHONE_3_0 && TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR +#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE +#if !TARGET_IPHONE_SIMULATOR if (self.accessGroup) { [dictionary setObject:self.accessGroup forKey:(__bridge id)kSecAttrAccessGroup]; } #endif +#endif #ifdef SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE if ([[self class] isSynchronizationAvailable]) {