Husein Behboodi Rad Husein Behboodi Rad - 9 months ago 35
iOS Question

What is Android keystore digest equaivalent in iOS apps

In Android application developers use a

to sign their applications. They can fetch the digest of the
by using some Android SDK's like
. The keystore digest is unique for same apps even after update.

Some third developers use this digest in their third APIs. For example it is using in Maps API of google.

Now I am wondered is there something like this in iOS. So that we can fetch it from iOS SDK and it be unique for all versions of my application?

Answer Source

Base on my researches we can use Team ID as an equivalent for identifying the signer of an app.

Team ID is a unique identifier associated to a development team in iTunes Connect and each app that is publishing with any kind of Apple accounts (including organization, individual or enterprise ) has these unique identifier.

Just we should notice that we have to read this from the iOS SDK not hardcoding it in the plist. I use below code:

CFStringRef string = CFUUIDCreateString(NULL, theUUID);

NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys:
                       (__bridge NSString *)kSecClassGenericPassword,
                       (__bridge NSString *)kSecClass,
                       string, kSecAttrAccount,
                       @"", kSecAttrService,
                       (id)kCFBooleanTrue, kSecReturnAttributes,
CFDictionaryRef result = nil;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query,
                                      (CFTypeRef *)&result
if (status == errSecItemNotFound)
    status = SecItemAdd((__bridge CFDictionaryRef)query, (CFTypeRef *)&result);
if (status != errSecSuccess)
    return nil;
NSString *accessGroup = [(__bridge NSDictionary *)result objectForKey:
                         (__bridge NSString *)kSecAttrAccessGroup
NSArray *components = [accessGroup componentsSeparatedByString:@"."];
NSString *bundleSeedID = [[components objectEnumerator] nextObject];

Finally the bundleSeedID contains the teamID of current app.