Dear Apple Developer Support Team, I would like to inquire whether there is a stable and official method to obtain the correct Team ID. When my app attempts to store data in the Keychain on a physical device, the retrieved Team ID is an unknown one and does not match the Team ID of my developer certificate. This issue consistently results in Keychain access failure with error code -34018. Could you please advise the root cause and provide a reliable solution to fix this Team ID mismatch and resolve the -34018 Keychain error?
NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys:
kSecClassGenericPassword, kSecClass,
@"bundleSeedID", kSecAttrAccount,
@"", kSecAttrService,
(id)kCFBooleanTrue, kSecReturnAttributes,
nil];
CFDictionaryRef result = nil;
OSStatus status = SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef *)&result);
if (status == errSecItemNotFound)
status = SecItemAdd((CFDictionaryRef)query, (CFTypeRef *)&result);
if (status != errSecSuccess)
return nil;
NSString *accessGroup = [(__bridge NSDictionary *)result objectForKey:kSecAttrAccessGroup];
NSArray *components = [accessGroup componentsSeparatedByString:@"."];
NSString *bundleSeedID = [[components objectEnumerator] nextObject];
CFRelease(result);
return bundleSeedID;
it cannot be debugged.
Why is that?
The same IPA file is installed on both this problematic device and the normally functioning devices.
How do you create that .ipa?
The usual process for doing that is to export an Ad Hoc signed version of your app. If that’s the case then you can export a Development signed version from the some Xcode archive. At that point you have an exact some copy of the code that you can run and debug with Xcode.
Just to be sure, you should check the keychain entitlements for each build. The .ipa is a zip archive under the covers, so you can change the extension to .zip and unpack it. Once you do that, dump the entitlements like so:
% codesign -d --entitlements - /path/to/my.app
Then use the same command to dump the entitlements of the Development signed version.
Finally, compare the three keychain entitlements discussed in Sharing access to keychain items among a collection of apps. I’d expect them to be the same in both cases and, if so, that means it’s valid to investigate this issue by debug your Development signed build.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"