@@ -149,9 +149,9 @@ + (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;
152+ static NSString *_securityAccessGroup = nil ;
153+ static dispatch_once_t onceToken = 0 ;
154+ dispatch_once (&onceToken, ^{
155155
156156 // The keychain cannot be empty prior to requesting the security access group string. Add a tmp variable.
157157 NSError *error = [self storeDate: [NSDate date ] forService: @" BranchKeychainService" key: @" Temp" cloudAccessGroup: nil ];
@@ -168,18 +168,23 @@ + (NSString * _Nullable)securityAccessGroup {
168168 };
169169 CFDictionaryRef resultDictionary = NULL ;
170170 OSStatus status = SecItemCopyMatching ((__bridge CFDictionaryRef)dictionary, (CFTypeRef*)&resultDictionary);
171- if (status == errSecItemNotFound) return nil ;
171+
172+ if (status == errSecItemNotFound) {
173+ return ;
174+ }
172175 if (status != errSecSuccess) {
173176 [[BranchLogger shared ] logWarning: [NSString stringWithFormat: @" Failed to retrieve security access group" ] error: [self errorWithKey: nil OSStatus: status]];
174- return nil ;
177+ return ;
175178 }
176179 NSString *group = [(__bridge NSDictionary *)resultDictionary objectForKey: (__bridge NSString *)kSecAttrAccessGroup ];
177180 if (group.length > 0 ) {
178181 _securityAccessGroup = [group copy ];
179182 }
180183 CFRelease (resultDictionary);
181- return _securityAccessGroup;
182- }
184+ });
185+
186+ return _securityAccessGroup;
187+
183188}
184189
185190@end
0 commit comments