Keychain error -34018 is Back

Just upgraded to Xcode 8b2 and launched an app I've been working on and got this erro:


[OSStatus] error:[-34018] Error Domain=NSOSStatusErrorDomain Code=-34018 "client has neither application-identifier nor keychain-access-groups entitlements" UserInfo={NSDescription=client has neither application-identifier nor keychain-access-groups entitlements}


Sounds just like https://forums.developer.apple.com/thread/4743 from last year. Seems like for now my app is unable to access the Keychain at all, at least in the simulator. Works fine when I run it on a device. Anyone else seeing this with iOS 10?

Replies

I noticed this myself this morning... The workaround I found is to just enabled Keychain Sharing.

That does indeed work around the problem, though it's not the "correct solution", of course. Will file a radar.

Filed rdar://27196346 with this code, which replicates the issue:


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSDictionary *query = @{
        (__bridge id)kSecClass:       (__bridge id)kSecClassGenericPassword,
        (__bridge id)kSecAttrService: @"SomeAttrService",
        (__bridge id)kSecAttrAccount: @"SomeAccount",
        (__bridge id)kSecAttrGeneric: @"SomeGeneric",
        (__bridge id)kSecValueData:   [@"SomeValue" dataUsingEncoding:NSUTF8StringEncoding],
        (__bridge id)kSecAttrAccessible: (__bridge id)kSecAttrAccessibleAfterFirstUnlock,
    };
   
    OSStatus status = SecItemAdd((__bridge CFDictionaryRef)query, NULL);
    if (status != errSecSuccess) {
        NSLog(@"Error saving key: %i", (int)status);
    }
    return YES;
}

Ugggggh!!!! Happening here too. Was so happy this issue was "resolved". I guess I need to get back on the bug filing train.

Did you get a reply? The issue only seems to happen to me when I run unit tests. Enabling shared keychain and running on actual app is working on fine (on simulator).

Just got bitten by this bug as well.

I'm seeing this as well from betas 2 through 6. Enabling keychain sharing entitlement works around the issue. Filed a radar. rdar://27867529

I've also been seeing this issue in the same set of betas you have and reported it as a bug #27829053 (XCUITest run in Xcode Server Bot hangs when uploading screenshots.). However, I'm trying to test keychain API calls in a Cocoa Touch Framework with unit tests, and probably can't use the "Keychain sharing" workaround that seems to work for others. Any ideas? Thanks!

No, I did not get a reply. :-(

Sorry, I just looked and I did get a reply asking for a request for a project and a compiled binary exhibiting the issue. Waiting to hear back again. Will post a nag…

Got the same issue on Xcode_8_beta_6 any replies from apple?

We are seeing the same issue in our test targets. We have a Keychain wrapper that we have a bunch of tests around that all pass on macOS and tvOS, but all fail on iOS due to the -38014 error being continuously returned from the `SecItemAdd` API. I just filed rdar://28117856 which I'm assuming will be closed out as a duplicate. I'm really hoping Apple gets this fixed before the GM.

Still appears to be an issue in Xcode 8 GM.

We have a library project that we're unable to test because of this (Xcode 8 GM).

rdar://28237779