Created
August 27, 2012 04:23
-
-
Save zwang/3485526 to your computer and use it in GitHub Desktop.
Use Apple's KeychainItemWrapper in ARC project from @ErikEvenson
This file contains 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
Thanks to ErikEvenson https://github.com/ErikEvenson | |
I did three things to use Apple's current sample code in my ARC projects: | |
1) Set -fno-objc-arc as a compiler flag on KeychainItemWrapper.m under Build Phases, Compile Sources. | |
2) Use __bridge_transfer in the call to the wrapper: NSString *password = [wrapper objectForKey:(__bridge_transfer id)kSecValueData]; | |
3) Add an autorelease to line 196 of Apple's code to plug Apple's memory leak: self.keychainItemData = [[[NSMutableDictionary alloc] init] autorelease]; | |
Another solution which rewrites the code in ARC can be found here | |
https://gist.github.com/1170641 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment