Skip to content
This repository was archived by the owner on Aug 24, 2019. It is now read-only.

Commit 927bfe1

Browse files
gabrielsoffes
authored andcommitted
Support for kSecAttrAccessGroup in Mac OSX 9 >=
1 parent 7a99dd5 commit 927bfe1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Sources/SSKeychainQuery.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
#define SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE 1
2020
#endif
2121

22+
#if __IPHONE_3_0 || __MAC_10_9
23+
// Keychain access group available at compile time
24+
#define SSKEYCHAIN_ACCESS_GROUP_AVAILABLE 1
25+
#endif
26+
2227
#ifdef SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE
2328
typedef NS_ENUM(NSUInteger, SSKeychainQuerySynchronizationMode) {
2429
SSKeychainQuerySynchronizationModeAny,
@@ -41,7 +46,7 @@ typedef NS_ENUM(NSUInteger, SSKeychainQuerySynchronizationMode) {
4146
/** kSecAttrLabel */
4247
@property (nonatomic, copy) NSString *label;
4348

44-
#if __IPHONE_3_0 && TARGET_OS_IPHONE
49+
#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE
4550
/** kSecAttrAccessGroup (only used on iOS) */
4651
@property (nonatomic, copy) NSString *accessGroup;
4752
#endif

Sources/SSKeychainQuery.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @implementation SSKeychainQuery
1616
@synthesize label = _label;
1717
@synthesize passwordData = _passwordData;
1818

19-
#if __IPHONE_3_0 && TARGET_OS_IPHONE
19+
#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE
2020
@synthesize accessGroup = _accessGroup;
2121
#endif
2222

@@ -203,11 +203,13 @@ - (NSMutableDictionary *)query {
203203
[dictionary setObject:self.account forKey:(__bridge id)kSecAttrAccount];
204204
}
205205

206-
#if __IPHONE_3_0 && TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
206+
#ifdef SSKEYCHAIN_ACCESS_GROUP_AVAILABLE
207+
#if !TARGET_IPHONE_SIMULATOR
207208
if (self.accessGroup) {
208209
[dictionary setObject:self.accessGroup forKey:(__bridge id)kSecAttrAccessGroup];
209210
}
210211
#endif
212+
#endif
211213

212214
#ifdef SSKEYCHAIN_SYNCHRONIZATION_AVAILABLE
213215
if ([[self class] isSynchronizationAvailable]) {

0 commit comments

Comments
 (0)