@@ -149,37 +149,35 @@ + (NSError*) removeValuesForService:(NSString *)service key:(NSString *)key {
149149
150150// The security access group string is prefixed with the Apple Developer Team ID
151151+ (NSString * _Nullable)securityAccessGroup {
152- @synchronized (self) {
153- static NSString *_securityAccessGroup = nil ;
154- if (_securityAccessGroup) return _securityAccessGroup;
155-
156- // The keychain cannot be empty prior to requesting the security access group string. Add a tmp variable.
157- NSError *error = [self storeDate: [NSDate date ] forService: @" BranchKeychainService" key: @" Temp" cloudAccessGroup: nil ];
158- if (error) {
159- [[BranchLogger shared ] logWarning: @" Failed to store temp value" error: error];
160- }
161-
162- NSDictionary * dictionary = @{
163- (__bridge id )kSecClass : (__bridge id )kSecClassGenericPassword ,
164- (__bridge id )kSecAttrService : @" BranchKeychainService" ,
165- (__bridge id )kSecReturnAttributes : (__bridge id )kCFBooleanTrue ,
166- (__bridge id )kSecAttrSynchronizable : (__bridge id )kSecAttrSynchronizableAny ,
167- (__bridge id )kSecMatchLimit : (__bridge id )kSecMatchLimitOne
168- };
169- CFDictionaryRef resultDictionary = NULL ;
170- OSStatus status = SecItemCopyMatching ((__bridge CFDictionaryRef)dictionary, (CFTypeRef*)&resultDictionary);
171- if (status == errSecItemNotFound) return nil ;
172- if (status != errSecSuccess) {
173- [[BranchLogger shared ] logWarning: [NSString stringWithFormat: @" Failed to retrieve security access group" ] error: [self errorWithKey: nil OSStatus: status]];
174- return nil ;
175- }
176- NSString *group = [(__bridge NSDictionary *)resultDictionary objectForKey: (__bridge NSString *)kSecAttrAccessGroup ];
177- if (group.length > 0 ) {
178- _securityAccessGroup = [group copy ];
179- }
180- CFRelease (resultDictionary);
181- return _securityAccessGroup;
152+ static NSString *_securityAccessGroup = nil ;
153+ if (_securityAccessGroup) return _securityAccessGroup;
154+
155+ // The keychain cannot be empty prior to requesting the security access group string. Add a tmp variable.
156+ NSError *error = [self storeDate: [NSDate date ] forService: @" BranchKeychainService" key: @" Temp" cloudAccessGroup: nil ];
157+ if (error) {
158+ [[BranchLogger shared ] logWarning: @" Failed to store temp value" error: error];
159+ }
160+
161+ NSDictionary * dictionary = @{
162+ (__bridge id )kSecClass : (__bridge id )kSecClassGenericPassword ,
163+ (__bridge id )kSecAttrService : @" BranchKeychainService" ,
164+ (__bridge id )kSecReturnAttributes : (__bridge id )kCFBooleanTrue ,
165+ (__bridge id )kSecAttrSynchronizable : (__bridge id )kSecAttrSynchronizableAny ,
166+ (__bridge id )kSecMatchLimit : (__bridge id )kSecMatchLimitOne
167+ };
168+ CFDictionaryRef resultDictionary = NULL ;
169+ OSStatus status = SecItemCopyMatching ((__bridge CFDictionaryRef)dictionary, (CFTypeRef*)&resultDictionary);
170+ if (status == errSecItemNotFound) return nil ;
171+ if (status != errSecSuccess) {
172+ [[BranchLogger shared ] logWarning: [NSString stringWithFormat: @" Failed to retrieve security access group" ] error: [self errorWithKey: nil OSStatus: status]];
173+ return nil ;
174+ }
175+ NSString *group = [(__bridge NSDictionary *)resultDictionary objectForKey: (__bridge NSString *)kSecAttrAccessGroup ];
176+ if (group.length > 0 ) {
177+ _securityAccessGroup = [group copy ];
182178 }
179+ CFRelease (resultDictionary);
180+ return _securityAccessGroup;
183181}
184182
185183@end
0 commit comments