├── LxKeychainDemo ├── LxKeychainDemo │ ├── ViewController.h │ ├── AppDelegate.m │ ├── AppDelegate.h │ ├── main.m │ ├── LxKeychainDemo.entitlements │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.xib │ ├── Info.plist │ └── ViewController.m └── LxKeychainDemo.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── project.pbxproj ├── .gitignore ├── LxKeychain.podspec ├── README.md ├── LxKeychain ├── LxKeychain.h └── LxKeychain.m └── LICENSE /LxKeychainDemo/LxKeychainDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LxKeychainDemo 4 | // 5 | 6 | #import 7 | 8 | @interface ViewController : UIViewController 9 | 10 | 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LxKeychainDemo 4 | // 5 | 6 | #import "AppDelegate.h" 7 | 8 | @interface AppDelegate () 9 | 10 | @end 11 | 12 | @implementation AppDelegate 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LxKeychainDemo 4 | // 5 | 6 | #import 7 | 8 | @interface AppDelegate : UIResponder 9 | 10 | @property (strong, nonatomic) UIWindow *window; 11 | 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LxKeychainDemo 4 | // 5 | 6 | #import 7 | #import "AppDelegate.h" 8 | 9 | int main(int argc, char * argv[]) { 10 | @autoreleasepool { 11 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/LxKeychainDemo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | keychain-access-groups 8 | 9 | $(AppIdentifierPrefix)com.etiantian.LxKeychainDemo 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | .DS_Store 4 | build/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.hmap 18 | *.ipa 19 | *.xcuserstate 20 | 21 | # CocoaPods 22 | # 23 | # We recommend against adding the Pods directory to your .gitignore. However 24 | # you should judge for yourself, the pros and cons are mentioned at: 25 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 26 | # 27 | #Pods/ 28 | -------------------------------------------------------------------------------- /LxKeychain.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "LxKeychain" 3 | s.version = "1.0.0" 4 | s.summary = "Manage your username and password for iOS and OS X platform. Highly encryption and won't be lose even you uninstall your app." 5 | 6 | s.homepage = "https://github.com/DeveloperLx/LxKeychain" 7 | s.license = 'Apache' 8 | s.authors = { 'DeveloperLx' => 'developerlx@yeah.com' } 9 | s.platform = :ios, "6.0" 10 | s.ios.deployment_target = "6.0" 11 | s.source = { :git => "https://github.com/DeveloperLx/LxKeychain.git", :tag => s.version} 12 | s.source_files = 'LxKeychain/LxKeychain.*' 13 | s.requires_arc = true 14 | s.frameworks = 'Foundation', 'CoreGraphics', 'Security', 'UIKit' 15 | end 16 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.etiantian.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LxKeychainDemo 4 | // 5 | 6 | #import "ViewController.h" 7 | #import "LxKeychain.h" 8 | 9 | @interface ViewController () 10 | 11 | @end 12 | 13 | @implementation ViewController 14 | 15 | - (void)viewDidLoad { 16 | [super viewDidLoad]; 17 | 18 | NSLog(@"savedUsernameArray = %@", [LxKeychain savedUsernameArray]); // 19 | 20 | [LxKeychain insertOrUpdatePairsOfUsername:@"username1" password:@"password1"]; 21 | [LxKeychain insertOrUpdatePairsOfUsername:@"username2" password:@"password2"]; 22 | [LxKeychain insertOrUpdatePairsOfUsername:@"username3" password:@"password3"]; 23 | [LxKeychain insertOrUpdatePairsOfUsername:@"username1" password:@"password4"]; 24 | [LxKeychain cleanPasswordForUsername:@"username2"]; 25 | [LxKeychain deletePairsByUsername:@"username3"]; 26 | NSLog(@"savedUsernameArray = %@", [LxKeychain savedUsernameArray]); // 27 | NSLog(@"username1 password: %@", [LxKeychain passwordForUsername:@"username1"]); // 28 | NSLog(@"username1's password %@ password1", [LxKeychain password:@"password1" isCorrectToUsername:@"username1"]?@"is":@"is not"); // 29 | NSLog(@"username1's password %@ password4", [LxKeychain password:@"password4" isCorrectToUsername:@"username1"]?@"is":@"is not"); // 30 | NSLog(@"lastestUpdatedUsername = %@", [LxKeychain lastestUpdatedUsername]); // 31 | 32 | static NSString * const YourSaveKey = @"Your save key!"; 33 | NSLog(@"Your saved string: %@", [LxKeychain fetchDataOfService:YourSaveKey]); // 34 | [LxKeychain saveData:@"Here is What you want to save forever!" forService:YourSaveKey]; 35 | 36 | NSLog(@"Your LxKeychain device unique identifer is %@", [LxKeychain deviceUniqueIdentifer]); // 37 | NSLog(@"Your keychain access group is %@", [LxKeychain accessGroupName]); // 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LxKeychain 2 | Manage your username and password for iOS and OS X platform. Highly encryption and won't be lose even you uninstall your app. 3 | Installation 4 | ------------ 5 | You only need drag LxKeychain.h and LxKeychain.m to your project. 6 | Podfile 7 | ------------ 8 | pod 'LxKeychain', '~> 1.0.0' 9 | Support 10 | ------------ 11 | Minimum support iOS version: iOS 6.0 12 | Usage 13 | -------------- 14 | 15 | NSLog(@"savedUsernameArray = %@", [LxKeychain savedUsernameArray]); // 16 | 17 | [LxKeychain insertOrUpdatePairsOfUsername:@"username1" password:@"password1"]; 18 | [LxKeychain insertOrUpdatePairsOfUsername:@"username2" password:@"password2"]; 19 | [LxKeychain insertOrUpdatePairsOfUsername:@"username3" password:@"password3"]; 20 | [LxKeychain insertOrUpdatePairsOfUsername:@"username1" password:@"password4"]; 21 | [LxKeychain cleanPasswordForUsername:@"username2"]; 22 | [LxKeychain deletePairsByUsername:@"username3"]; 23 | NSLog(@"savedUsernameArray = %@", [LxKeychain savedUsernameArray]); // 24 | NSLog(@"username1 password: %@", [LxKeychain passwordForUsername:@"username1"]); // 25 | NSLog(@"username1's password %@ password1", [LxKeychain password:@"password1" isCorrectToUsername:@"username1"]?@"is":@"is not"); // 26 | NSLog(@"username1's password %@ password4", [LxKeychain password:@"password4" isCorrectToUsername:@"username1"]?@"is":@"is not"); // 27 | NSLog(@"lastestUpdatedUsername = %@", [LxKeychain lastestUpdatedUsername]); // 28 | 29 | static NSString * const YourSaveKey = @"Your save key!"; 30 | NSLog(@"Your saved string: %@", [LxKeychain fetchDataOfService:YourSaveKey]); // 31 | [LxKeychain saveData:@"Here is What you want to save forever!" forService:YourSaveKey]; 32 | 33 | NSLog(@"Your LxKeychain device unique identifer is %@", [LxKeychain deviceUniqueIdentifer]); // 34 | NSLog(@"Your keychain access group is %@", [LxKeychain accessGroupName]); // 35 | 36 | // You can try to run once, then uninstall your app, then build and run it again. You will see shocking phenomena! 37 | License 38 | ----------- 39 | LxKeychain is available under the Apache License 2.0. See the LICENSE file for more info. 40 | -------------------------------------------------------------------------------- /LxKeychain/LxKeychain.h: -------------------------------------------------------------------------------- 1 | // 2 | // DeveloperLx 3 | // LxKeychain.h 4 | // 5 | 6 | /* -------------------- OSStatus probably value -------------------- 7 | errSecSuccess = 0, No error. 8 | errSecUnimplemented = -4, Function or operation not implemented. 9 | errSecIO = -36, I/O error (bummers) 10 | errSecOpWr = -49, file already open with with write permission 11 | errSecParam = -50, One or more parameters passed to a function where not valid. 12 | errSecAllocate = -108, Failed to allocate memory. 13 | errSecUserCanceled = -128, User canceled the operation. 14 | errSecBadReq = -909, Bad parameter or invalid state for operation. 15 | errSecInternalComponent = -2070, 16 | errSecNotAvailable = -25291, No keychain is available. You may need to restart your computer. 17 | errSecDuplicateItem = -25299, The specified item already exists in the keychain. 18 | errSecItemNotFound = -25300, The specified item could not be found in the keychain. 19 | errSecInteractionNotAllowed = -25308, User interaction is not allowed. 20 | errSecDecode = -26275, Unable to decode the provided data. 21 | errSecAuthFailed = -25293, The user name or passphrase you entered is not correct. 22 | */ 23 | 24 | #import 25 | #import 26 | 27 | #define LX_UNAVAILABLE(msg) __attribute__((unavailable(msg))) 28 | 29 | typedef NSString * (^ EncrytionBlock)(NSString *); 30 | /* 31 | * Can be customed by yourself. Default use md5. 32 | */ 33 | static EncrytionBlock LxKeychainEncryptionBlock = ^(NSString * string) { 34 | const char * cPlaintext = string.UTF8String; 35 | unsigned char result[CC_MD5_DIGEST_LENGTH]; 36 | CC_MD5(cPlaintext, (CC_LONG)strlen(cPlaintext), result); 37 | NSMutableString * hash = [NSMutableString string]; 38 | for (int i = 0; i < 16; i++) 39 | [hash appendFormat:@"%02X", result[i]]; 40 | return [NSString stringWithString:hash.lowercaseString]; 41 | }; 42 | 43 | @interface LxKeychain : NSObject 44 | 45 | + (OSStatus)insertOrUpdatePairsOfUsername:(NSString *)username password:(NSString *)password; 46 | + (OSStatus)cleanPasswordForUsername:(NSString *)username; 47 | + (OSStatus)deletePairsByUsername:(NSString *)username; 48 | + (NSString *)passwordForUsername:(NSString *)username; 49 | + (BOOL)password:(NSString *)password isCorrectToUsername:(NSString *)username; 50 | + (NSArray *)savedUsernameArray; 51 | + (NSString *)lastestUpdatedUsername; 52 | 53 | + (OSStatus)saveData:(id)data forService:(NSString *)service; 54 | + (id)fetchDataOfService:(NSString *)service; 55 | + (OSStatus)deleteService:(NSString *)service; 56 | 57 | + (NSString *)accessGroupName; 58 | 59 | #if TARGET_OS_IOS 60 | 61 | + (NSString *)deviceUniqueIdentifer; 62 | 63 | #endif 64 | 65 | #pragma mark - Unavailable 66 | 67 | - (instancetype)init LX_UNAVAILABLE("LxKeychain cannot be initialized!"); 68 | - (instancetype)initWithCoder:(NSCoder *)aDecoder LX_UNAVAILABLE("LxKeychain cannot be initialized!"); 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LxKeychain/LxKeychain.m: -------------------------------------------------------------------------------- 1 | // 2 | // DeveloperLx 3 | // LxKeychain.m 4 | // 5 | 6 | #import "LxKeychain.h" 7 | #import 8 | 9 | #if TARGET_OS_IOS 10 | #import 11 | static NSString * const LX_DEVICE_UNIQUE_IDENTIFIER = @"LX_DEVICE_UNIQUE_IDENTIFIER"; 12 | #endif 13 | 14 | static NSString * const LX_USERNAME_ARRAY_SERVICE = @"LX_USERNAME_ARRAY_SERVICE"; 15 | static NSString * const LX_USERNAME_KEY = @"LX_USERNAME_KEY"; 16 | static NSString * const LX_PASSWORD_KEY = @"LX_PASSWORD_KEY"; 17 | 18 | @implementation LxKeychain 19 | 20 | + (NSString *)generateServiceByUsername:(NSString *)username 21 | { 22 | return LxKeychainEncryptionBlock(username); 23 | } 24 | 25 | + (OSStatus)insertOrUpdatePairsOfUsername:(NSString *)username password:(NSString *)password 26 | { 27 | NSString * service = [self generateServiceByUsername:username]; 28 | OSStatus status = noErr; 29 | status = [self deleteService:service]; 30 | status = [self saveData:password forService:service]; 31 | 32 | NSString * usernameArrayService = LxKeychainEncryptionBlock(LX_USERNAME_ARRAY_SERVICE); 33 | NSMutableArray * savedUsernameArray = [NSMutableArray arrayWithArray:[self savedUsernameArray]]; 34 | if ([savedUsernameArray containsObject:username]) { 35 | [savedUsernameArray removeObject:username]; 36 | } 37 | [savedUsernameArray addObject:username]; 38 | status = [self deleteService:usernameArrayService]; 39 | status = [self saveData:[NSArray arrayWithArray:savedUsernameArray] forService:usernameArrayService]; 40 | 41 | return status; 42 | } 43 | 44 | + (OSStatus)cleanPasswordForUsername:(NSString *)username 45 | { 46 | NSString * service = [self generateServiceByUsername:username]; 47 | OSStatus status = noErr; 48 | status = [self deleteService:service]; 49 | status = [self saveData:nil forService:service]; 50 | return status; 51 | } 52 | 53 | + (OSStatus)deletePairsByUsername:(NSString *)username 54 | { 55 | NSString * service = [self generateServiceByUsername:username]; 56 | OSStatus status = noErr; 57 | status = [self deleteService:service]; 58 | 59 | NSString * usernameArrayService = LxKeychainEncryptionBlock(LX_USERNAME_ARRAY_SERVICE); 60 | NSMutableArray * savedUsernameArray = [NSMutableArray arrayWithArray:[self savedUsernameArray]]; 61 | if ([savedUsernameArray containsObject:username]) { 62 | [savedUsernameArray removeObject:username]; 63 | } 64 | status = [self deleteService:usernameArrayService]; 65 | status = [self saveData:[NSArray arrayWithArray:savedUsernameArray] forService:usernameArrayService]; 66 | 67 | return status; 68 | } 69 | 70 | + (NSString *)passwordForUsername:(NSString *)username 71 | { 72 | NSString * service = [self generateServiceByUsername:username]; 73 | return (NSString *)[self fetchDataOfService:service]; 74 | } 75 | 76 | + (BOOL)password:(NSString *)password isCorrectToUsername:(NSString *)username 77 | { 78 | if (password.length == 0) { 79 | return NO; 80 | } 81 | else { 82 | return [password isEqualToString:[self passwordForUsername:username]]; 83 | } 84 | } 85 | 86 | + (NSArray *)savedUsernameArray 87 | { 88 | NSString * usernameArrayService = LxKeychainEncryptionBlock(LX_USERNAME_ARRAY_SERVICE); 89 | return (NSArray *)[self fetchDataOfService:usernameArrayService]; 90 | } 91 | 92 | + (NSString *)lastestUpdatedUsername 93 | { 94 | return (NSString *)([self savedUsernameArray].lastObject); 95 | } 96 | 97 | + (NSMutableDictionary *)generateQueryMutableDictionaryOfService:(NSString *)service 98 | { 99 | return [NSMutableDictionary dictionaryWithObjectsAndKeys: 100 | (__bridge id)kSecClassGenericPassword, (__bridge id)kSecClass, 101 | (__bridge id)kSecAttrAccessibleAfterFirstUnlock, (__bridge id)kSecAttrAccessible, 102 | service, (__bridge id)kSecAttrService, 103 | service, (__bridge id)kSecAttrAccount, 104 | #if !TARGET_IPHONE_SIMULATOR 105 | [self accessGroupName], (__bridge id)kSecAttrAccessGroup, 106 | #endif 107 | nil]; 108 | } 109 | 110 | + (OSStatus)saveData:(id)data forService:(NSString *)service 111 | { 112 | NSAssert([(NSObject *)data conformsToProtocol:@protocol(NSCoding)] || data == nil, @"data must conforms protocol NSCoding or NSSecureCoding!"); // 113 | 114 | NSMutableDictionary * keychainQuery = [self generateQueryMutableDictionaryOfService:service]; 115 | OSStatus status = noErr; 116 | status = SecItemDelete((__bridge CFDictionaryRef)keychainQuery); 117 | 118 | [keychainQuery setValue:[NSKeyedArchiver archivedDataWithRootObject:data] forKey:(__bridge id)kSecValueData]; 119 | CFTypeRef result = 0; 120 | status = SecItemAdd((__bridge CFDictionaryRef)keychainQuery, &result); 121 | 122 | return status; 123 | } 124 | 125 | + (id)fetchDataOfService:(NSString *)service 126 | { 127 | NSMutableDictionary * keychainQuery = [self generateQueryMutableDictionaryOfService:service]; 128 | [keychainQuery setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnData]; 129 | [keychainQuery setObject:(__bridge id)kSecMatchLimitOne forKey:(__bridge id)kSecMatchLimit]; 130 | 131 | OSStatus status = noErr; 132 | 133 | CFDataRef archivedData = NULL; 134 | status = SecItemCopyMatching((__bridge CFDictionaryRef)keychainQuery, (CFTypeRef *)&archivedData); 135 | 136 | if (status == noErr) { 137 | id data = nil; 138 | @try { 139 | data = [NSKeyedUnarchiver unarchiveObjectWithData:(__bridge NSData *)archivedData]; 140 | } 141 | @catch (NSException * exception) { 142 | NSLog(@"Unarchive of %@ failed: %@", service, exception); 143 | } 144 | @finally { 145 | if (archivedData) { 146 | CFRelease(archivedData); 147 | } 148 | return data; 149 | } 150 | } 151 | else { 152 | return nil; 153 | } 154 | } 155 | 156 | + (OSStatus)saveString:(NSString *)string forService:(NSString *)service 157 | { 158 | NSMutableDictionary * keychainQuery = [self generateQueryMutableDictionaryOfService:service]; 159 | OSStatus status = noErr; 160 | status = SecItemDelete((__bridge CFDictionaryRef)keychainQuery); 161 | 162 | [keychainQuery setValue:string forKey:(__bridge id)kSecValueData]; 163 | CFTypeRef result = 0; 164 | status = SecItemAdd((__bridge CFDictionaryRef)keychainQuery, &result); 165 | 166 | return status; 167 | } 168 | 169 | + (NSString *)fetchStringOfService:(NSString *)service 170 | { 171 | NSMutableDictionary * keychainQuery = [self generateQueryMutableDictionaryOfService:service]; 172 | [keychainQuery setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnData]; 173 | [keychainQuery setObject:(__bridge id)kSecMatchLimitOne forKey:(__bridge id)kSecMatchLimit]; 174 | 175 | OSStatus status = noErr; 176 | 177 | CFDataRef archivedData = NULL; 178 | status = SecItemCopyMatching((__bridge CFDictionaryRef)keychainQuery, (CFTypeRef *)&archivedData); 179 | 180 | if (status == noErr && archivedData) { 181 | 182 | NSString * string = [[NSString alloc]initWithData:(__bridge NSData *)archivedData encoding:NSUTF8StringEncoding]; 183 | CFRelease(archivedData); 184 | return string; 185 | } 186 | else { 187 | return nil; 188 | } 189 | } 190 | 191 | + (OSStatus)deleteService:(NSString *)service 192 | { 193 | NSMutableDictionary * keychainQuery = [self generateQueryMutableDictionaryOfService:service]; 194 | return SecItemDelete((__bridge CFDictionaryRef)keychainQuery); 195 | } 196 | 197 | + (NSString *)accessGroupName 198 | { 199 | NSDictionary *keychainQuery = @{(__bridge id)kSecClass : (__bridge id)kSecClassGenericPassword, 200 | (__bridge id)kSecAttrAccount : @"bundleSeedID", 201 | (__bridge id)kSecAttrService : @"", 202 | (__bridge id)kSecReturnAttributes : (__bridge id)kCFBooleanTrue}; 203 | 204 | CFDictionaryRef result = NULL; 205 | OSStatus status = SecItemCopyMatching((CFDictionaryRef)keychainQuery, (CFTypeRef *)&result); 206 | if (status == errSecItemNotFound) { 207 | status = SecItemAdd((CFDictionaryRef)keychainQuery, (CFTypeRef *)&result); 208 | } 209 | if (status != errSecSuccess) { 210 | return nil; 211 | } 212 | NSString * accessGroup = [(__bridge NSDictionary *)result objectForKey:(__bridge id)kSecAttrAccessGroup]; 213 | CFRelease(result); 214 | return accessGroup; 215 | } 216 | 217 | #if TARGET_OS_IOS 218 | 219 | + (NSString *)deviceUniqueIdentifer 220 | { 221 | NSString * deviceUniqueIdentifer = (NSString *)[self fetchDataOfService:LX_DEVICE_UNIQUE_IDENTIFIER]; 222 | 223 | if (!deviceUniqueIdentifer) { 224 | 225 | deviceUniqueIdentifer = [UIDevice currentDevice].identifierForVendor.UUIDString; 226 | [self saveString:deviceUniqueIdentifer forService:LX_DEVICE_UNIQUE_IDENTIFIER]; 227 | } 228 | 229 | return deviceUniqueIdentifer; 230 | } 231 | 232 | #endif 233 | 234 | @end 235 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /LxKeychainDemo/LxKeychainDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BF592A661AC8E45C000B50B4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BF592A651AC8E45C000B50B4 /* main.m */; }; 11 | BF592A691AC8E45C000B50B4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BF592A681AC8E45C000B50B4 /* AppDelegate.m */; }; 12 | BF592A6C1AC8E45C000B50B4 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF592A6B1AC8E45C000B50B4 /* ViewController.m */; }; 13 | BF592A6F1AC8E45C000B50B4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF592A6D1AC8E45C000B50B4 /* Main.storyboard */; }; 14 | BF592A711AC8E45C000B50B4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF592A701AC8E45C000B50B4 /* Images.xcassets */; }; 15 | BF592A741AC8E45C000B50B4 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF592A721AC8E45C000B50B4 /* LaunchScreen.xib */; }; 16 | BF592A8C1AC8E4D3000B50B4 /* LxKeychain.m in Sources */ = {isa = PBXBuildFile; fileRef = BF592A8B1AC8E4D3000B50B4 /* LxKeychain.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | B67F44DE1CF968EB00EC3E14 /* LxKeychainDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = LxKeychainDemo.entitlements; sourceTree = ""; }; 21 | BF592A601AC8E45C000B50B4 /* LxKeychainDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LxKeychainDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | BF592A641AC8E45C000B50B4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | BF592A651AC8E45C000B50B4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 24 | BF592A671AC8E45C000B50B4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | BF592A681AC8E45C000B50B4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | BF592A6A1AC8E45C000B50B4 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 27 | BF592A6B1AC8E45C000B50B4 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 28 | BF592A6E1AC8E45C000B50B4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | BF592A701AC8E45C000B50B4 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 30 | BF592A731AC8E45C000B50B4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 31 | BF592A8A1AC8E4D3000B50B4 /* LxKeychain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LxKeychain.h; sourceTree = ""; }; 32 | BF592A8B1AC8E4D3000B50B4 /* LxKeychain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LxKeychain.m; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | BF592A5D1AC8E45C000B50B4 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | BF592A571AC8E45C000B50B4 = { 47 | isa = PBXGroup; 48 | children = ( 49 | BF592A621AC8E45C000B50B4 /* LxKeychainDemo */, 50 | BF592A611AC8E45C000B50B4 /* Products */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | BF592A611AC8E45C000B50B4 /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | BF592A601AC8E45C000B50B4 /* LxKeychainDemo.app */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | BF592A621AC8E45C000B50B4 /* LxKeychainDemo */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | B67F44DE1CF968EB00EC3E14 /* LxKeychainDemo.entitlements */, 66 | BF592A891AC8E4D3000B50B4 /* LxKeychain */, 67 | BF592A671AC8E45C000B50B4 /* AppDelegate.h */, 68 | BF592A681AC8E45C000B50B4 /* AppDelegate.m */, 69 | BF592A6A1AC8E45C000B50B4 /* ViewController.h */, 70 | BF592A6B1AC8E45C000B50B4 /* ViewController.m */, 71 | BF592A6D1AC8E45C000B50B4 /* Main.storyboard */, 72 | BF592A701AC8E45C000B50B4 /* Images.xcassets */, 73 | BF592A721AC8E45C000B50B4 /* LaunchScreen.xib */, 74 | BF592A631AC8E45C000B50B4 /* Supporting Files */, 75 | ); 76 | path = LxKeychainDemo; 77 | sourceTree = ""; 78 | }; 79 | BF592A631AC8E45C000B50B4 /* Supporting Files */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | BF592A641AC8E45C000B50B4 /* Info.plist */, 83 | BF592A651AC8E45C000B50B4 /* main.m */, 84 | ); 85 | name = "Supporting Files"; 86 | sourceTree = ""; 87 | }; 88 | BF592A891AC8E4D3000B50B4 /* LxKeychain */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | BF592A8A1AC8E4D3000B50B4 /* LxKeychain.h */, 92 | BF592A8B1AC8E4D3000B50B4 /* LxKeychain.m */, 93 | ); 94 | name = LxKeychain; 95 | path = ../../LxKeychain; 96 | sourceTree = ""; 97 | }; 98 | /* End PBXGroup section */ 99 | 100 | /* Begin PBXNativeTarget section */ 101 | BF592A5F1AC8E45C000B50B4 /* LxKeychainDemo */ = { 102 | isa = PBXNativeTarget; 103 | buildConfigurationList = BF592A831AC8E45C000B50B4 /* Build configuration list for PBXNativeTarget "LxKeychainDemo" */; 104 | buildPhases = ( 105 | BF592A5C1AC8E45C000B50B4 /* Sources */, 106 | BF592A5D1AC8E45C000B50B4 /* Frameworks */, 107 | BF592A5E1AC8E45C000B50B4 /* Resources */, 108 | ); 109 | buildRules = ( 110 | ); 111 | dependencies = ( 112 | ); 113 | name = LxKeychainDemo; 114 | productName = LxKeychainDemo; 115 | productReference = BF592A601AC8E45C000B50B4 /* LxKeychainDemo.app */; 116 | productType = "com.apple.product-type.application"; 117 | }; 118 | /* End PBXNativeTarget section */ 119 | 120 | /* Begin PBXProject section */ 121 | BF592A581AC8E45C000B50B4 /* Project object */ = { 122 | isa = PBXProject; 123 | attributes = { 124 | LastUpgradeCheck = 0620; 125 | ORGANIZATIONNAME = etiantian; 126 | TargetAttributes = { 127 | BF592A5F1AC8E45C000B50B4 = { 128 | CreatedOnToolsVersion = 6.2; 129 | DevelopmentTeam = 4394J75KCV; 130 | SystemCapabilities = { 131 | com.apple.ApplicationGroups.iOS = { 132 | enabled = 0; 133 | }; 134 | com.apple.Keychain = { 135 | enabled = 1; 136 | }; 137 | }; 138 | }; 139 | }; 140 | }; 141 | buildConfigurationList = BF592A5B1AC8E45C000B50B4 /* Build configuration list for PBXProject "LxKeychainDemo" */; 142 | compatibilityVersion = "Xcode 3.2"; 143 | developmentRegion = English; 144 | hasScannedForEncodings = 0; 145 | knownRegions = ( 146 | en, 147 | Base, 148 | ); 149 | mainGroup = BF592A571AC8E45C000B50B4; 150 | productRefGroup = BF592A611AC8E45C000B50B4 /* Products */; 151 | projectDirPath = ""; 152 | projectRoot = ""; 153 | targets = ( 154 | BF592A5F1AC8E45C000B50B4 /* LxKeychainDemo */, 155 | ); 156 | }; 157 | /* End PBXProject section */ 158 | 159 | /* Begin PBXResourcesBuildPhase section */ 160 | BF592A5E1AC8E45C000B50B4 /* Resources */ = { 161 | isa = PBXResourcesBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | BF592A6F1AC8E45C000B50B4 /* Main.storyboard in Resources */, 165 | BF592A741AC8E45C000B50B4 /* LaunchScreen.xib in Resources */, 166 | BF592A711AC8E45C000B50B4 /* Images.xcassets in Resources */, 167 | ); 168 | runOnlyForDeploymentPostprocessing = 0; 169 | }; 170 | /* End PBXResourcesBuildPhase section */ 171 | 172 | /* Begin PBXSourcesBuildPhase section */ 173 | BF592A5C1AC8E45C000B50B4 /* Sources */ = { 174 | isa = PBXSourcesBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | BF592A6C1AC8E45C000B50B4 /* ViewController.m in Sources */, 178 | BF592A691AC8E45C000B50B4 /* AppDelegate.m in Sources */, 179 | BF592A661AC8E45C000B50B4 /* main.m in Sources */, 180 | BF592A8C1AC8E4D3000B50B4 /* LxKeychain.m in Sources */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXSourcesBuildPhase section */ 185 | 186 | /* Begin PBXVariantGroup section */ 187 | BF592A6D1AC8E45C000B50B4 /* Main.storyboard */ = { 188 | isa = PBXVariantGroup; 189 | children = ( 190 | BF592A6E1AC8E45C000B50B4 /* Base */, 191 | ); 192 | name = Main.storyboard; 193 | sourceTree = ""; 194 | }; 195 | BF592A721AC8E45C000B50B4 /* LaunchScreen.xib */ = { 196 | isa = PBXVariantGroup; 197 | children = ( 198 | BF592A731AC8E45C000B50B4 /* Base */, 199 | ); 200 | name = LaunchScreen.xib; 201 | sourceTree = ""; 202 | }; 203 | /* End PBXVariantGroup section */ 204 | 205 | /* Begin XCBuildConfiguration section */ 206 | BF592A811AC8E45C000B50B4 /* Debug */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = NO; 210 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 211 | CLANG_CXX_LIBRARY = "libc++"; 212 | CLANG_ENABLE_MODULES = YES; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_WARN_BOOL_CONVERSION = YES; 215 | CLANG_WARN_CONSTANT_CONVERSION = YES; 216 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INT_CONVERSION = YES; 220 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 221 | CLANG_WARN_UNREACHABLE_CODE = YES; 222 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 223 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 224 | COPY_PHASE_STRIP = NO; 225 | ENABLE_STRICT_OBJC_MSGSEND = YES; 226 | GCC_C_LANGUAGE_STANDARD = gnu99; 227 | GCC_DYNAMIC_NO_PIC = NO; 228 | GCC_OPTIMIZATION_LEVEL = 0; 229 | GCC_PREPROCESSOR_DEFINITIONS = ( 230 | "DEBUG=1", 231 | "$(inherited)", 232 | ); 233 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 234 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 236 | GCC_WARN_UNDECLARED_SELECTOR = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 238 | GCC_WARN_UNUSED_FUNCTION = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 241 | MTL_ENABLE_DEBUG_INFO = YES; 242 | ONLY_ACTIVE_ARCH = YES; 243 | SDKROOT = iphoneos; 244 | TARGETED_DEVICE_FAMILY = "1,2"; 245 | }; 246 | name = Debug; 247 | }; 248 | BF592A821AC8E45C000B50B4 /* Release */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ALWAYS_SEARCH_USER_PATHS = NO; 252 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 253 | CLANG_CXX_LIBRARY = "libc++"; 254 | CLANG_ENABLE_MODULES = YES; 255 | CLANG_ENABLE_OBJC_ARC = YES; 256 | CLANG_WARN_BOOL_CONVERSION = YES; 257 | CLANG_WARN_CONSTANT_CONVERSION = YES; 258 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_UNREACHABLE_CODE = YES; 264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 265 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 266 | COPY_PHASE_STRIP = NO; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu99; 270 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 271 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 272 | GCC_WARN_UNDECLARED_SELECTOR = YES; 273 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 274 | GCC_WARN_UNUSED_FUNCTION = YES; 275 | GCC_WARN_UNUSED_VARIABLE = YES; 276 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 277 | MTL_ENABLE_DEBUG_INFO = NO; 278 | SDKROOT = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Release; 283 | }; 284 | BF592A841AC8E45C000B50B4 /* Debug */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 288 | CODE_SIGN_ENTITLEMENTS = LxKeychainDemo/LxKeychainDemo.entitlements; 289 | INFOPLIST_FILE = LxKeychainDemo/Info.plist; 290 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 291 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 292 | PRODUCT_NAME = "$(TARGET_NAME)"; 293 | }; 294 | name = Debug; 295 | }; 296 | BF592A851AC8E45C000B50B4 /* Release */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 300 | CODE_SIGN_ENTITLEMENTS = LxKeychainDemo/LxKeychainDemo.entitlements; 301 | INFOPLIST_FILE = LxKeychainDemo/Info.plist; 302 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 303 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 304 | PRODUCT_NAME = "$(TARGET_NAME)"; 305 | }; 306 | name = Release; 307 | }; 308 | /* End XCBuildConfiguration section */ 309 | 310 | /* Begin XCConfigurationList section */ 311 | BF592A5B1AC8E45C000B50B4 /* Build configuration list for PBXProject "LxKeychainDemo" */ = { 312 | isa = XCConfigurationList; 313 | buildConfigurations = ( 314 | BF592A811AC8E45C000B50B4 /* Debug */, 315 | BF592A821AC8E45C000B50B4 /* Release */, 316 | ); 317 | defaultConfigurationIsVisible = 0; 318 | defaultConfigurationName = Release; 319 | }; 320 | BF592A831AC8E45C000B50B4 /* Build configuration list for PBXNativeTarget "LxKeychainDemo" */ = { 321 | isa = XCConfigurationList; 322 | buildConfigurations = ( 323 | BF592A841AC8E45C000B50B4 /* Debug */, 324 | BF592A851AC8E45C000B50B4 /* Release */, 325 | ); 326 | defaultConfigurationIsVisible = 0; 327 | defaultConfigurationName = Release; 328 | }; 329 | /* End XCConfigurationList section */ 330 | }; 331 | rootObject = BF592A581AC8E45C000B50B4 /* Project object */; 332 | } 333 | --------------------------------------------------------------------------------