Created
January 20, 2016 08:53
-
-
Save kam800/70ff776a3bb5818a0f56 to your computer and use it in GitHub Desktop.
Override TwitterKit keychain kSecAttrAccessible to kSecAttrAccessibleAfterFirstUnlock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import Foundation; | |
#import <objc/runtime.h> | |
@interface TWTRGenericKeychainItem: NSObject | |
- (NSMutableDictionary *)fullRawRepresentation; | |
@end | |
@interface TWTRGenericKeychainItem (KeychainFix) | |
@end | |
@implementation TWTRGenericKeychainItem (KeychainFix) | |
+ (void)load { | |
Class class = [self class]; | |
SEL originalSelector = @selector(fullRawRepresentation); | |
SEL swizzledSelector = @selector(changed_fullRawRepresentation); | |
Method originalMethod = class_getInstanceMethod(class, originalSelector); | |
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); | |
method_exchangeImplementations(originalMethod, swizzledMethod); | |
} | |
- (NSMutableDictionary *)changed_fullRawRepresentation { | |
NSMutableDictionary *d = [self changed_fullRawRepresentation]; | |
d[(__bridge id)kSecAttrAccessible] = (__bridge id)(kSecAttrAccessibleAfterFirstUnlock); | |
return d; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment