Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Adding #ifdef around kSecAttrAccessibleWhenUnlocked to prevent build …
Browse files Browse the repository at this point in the history
…error on OS X < 10.9
  • Loading branch information
mattt committed Nov 18, 2013
1 parent 0a105b7 commit c48e23b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions AFOAuth2Client/AFOAuth2Client.m
Expand Up @@ -271,10 +271,15 @@ - (BOOL)isExpired {

#ifdef _SECURITY_SECITEM_H_

+ (BOOL)storeCredential:(AFOAuthCredential *)credential
+ (BOOL)storeCredential:(AFOAuth1Token *)credential

This comment has been minimized.

Copy link
@jesseditson

jesseditson Dec 11, 2013

Is this a mistake? causes errors on my fork.

This comment has been minimized.

Copy link
@fjaeger

fjaeger Dec 11, 2013

Contributor

I think this is a copy&paste mistake and should be fixed.

withIdentifier:(NSString *)identifier
{
return [[self class] storeCredential:credential withIdentifier:identifier withAccessibility:(__bridge id)kSecAttrAccessibleWhenUnlocked];
id securityAccessibility = nil;
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 43000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090)
securityAccessibility = (__bridge id)kSecAttrAccessibleWhenUnlocked;
#endif

return [[self class] storeCredential:credential withIdentifier:identifier withAccessibility:securityAccessibility];
}

+ (BOOL)storeCredential:(AFOAuthCredential *)credential
Expand All @@ -290,7 +295,9 @@ + (BOOL)storeCredential:(AFOAuthCredential *)credential
NSMutableDictionary *updateDictionary = [NSMutableDictionary dictionary];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:credential];
[updateDictionary setObject:data forKey:(__bridge id)kSecValueData];
[updateDictionary setObject:securityAccessibility forKey:(__bridge id)kSecAttrAccessible];
if (securityAccessibility) {
[updateDictionary setObject:securityAccessibility forKey:(__bridge id)kSecAttrAccessible];
}

OSStatus status;
BOOL exists = ([self retrieveCredentialWithIdentifier:identifier] != nil);
Expand Down

1 comment on commit c48e23b

@fjaeger
Copy link
Contributor

@fjaeger fjaeger commented on c48e23b Dec 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFOAuth1Token is not defined. Please revert this to AFOAuthCredential

Please sign in to comment.