-
Re: Keychain error -34018 is Back
Jason Cox Jul 6, 2016 7:54 AM (in response to theory)I noticed this myself this morning... The workaround I found is to just enabled Keychain Sharing.
-
Re: Keychain error -34018 is Back
theory Jul 6, 2016 8:31 AM (in response to Jason Cox)That does indeed work around the problem, though it's not the "correct solution", of course. Will file a radar.
-
Re: Keychain error -34018 is Back
theory Jul 6, 2016 8:59 AM (in response to theory)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; }
-
Re: Keychain error -34018 is Back
Andy Ibanez Jul 22, 2016 12:20 PM (in response to theory)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).
-
Re: Keychain error -34018 is Back
theory Aug 23, 2016 5:24 PM (in response to Andy Ibanez)No, I did not get a reply. :-(
-
Re: Keychain error -34018 is Back
theory Aug 23, 2016 5:30 PM (in response to Andy Ibanez)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…
-
-
Re: Keychain error -34018 is Back
trickyWicket Aug 16, 2016 9:32 AM (in response to theory)I'm seeing this as well from betas 2 through 6. Enabling keychain sharing entitlement works around the issue. Filed a radar. rdar://27867529
-
Re: Keychain error -34018 is Back
cdisderoAtTibco Aug 17, 2016 11:29 AM (in response to trickyWicket)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!
-
Re: Keychain error -34018 is Back
cnoonNike Sep 1, 2016 10:41 AM (in response to cdisderoAtTibco)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.
-
Re: Keychain error -34018 is Back
Guillaume@Wemanity Oct 25, 2016 3:05 AM (in response to cdisderoAtTibco)Same issue here...
-
-
-
-
-
-
Re: Keychain error -34018 is Back
dmcgloini Jul 18, 2016 4:47 PM (in response to theory)Ugggggh!!!! Happening here too. Was so happy this issue was "resolved". I guess I need to get back on the bug filing train.
-
Re: Keychain error -34018 is Back
XCool Jul 31, 2016 11:32 PM (in response to theory)Just got bitten by this bug as well.
-
Re: Keychain error -34018 is Back
xsun Aug 31, 2016 12:37 PM (in response to theory)Got the same issue on Xcode_8_beta_6 any replies from apple?
-
Re: Keychain error -34018 is Back
Nic NZ Sep 8, 2016 6:54 PM (in response to theory)Still appears to be an issue in Xcode 8 GM.
-
Re: Keychain error -34018 is Back
trygve-invenia Sep 9, 2016 12:45 AM (in response to theory)We have a library project that we're unable to test because of this (Xcode 8 GM).
-
-
Re: Keychain error -34018 is Back
senkaK Sep 12, 2016 5:37 AM (in response to theory)Happening to me too on iOS10 simulator, XCode8 Beta 6. Keychain sharing is enabled, but it didn't help. I couldn't find any way around this, only using actual device helps.
-
Re: Keychain error -34018 is Back
jerryc Sep 13, 2016 5:16 PM (in response to theory)same for me as well. iOS 10 device working nicely, only simulator has problems.
sanityCheck = SecKeyGeneratePair((__bridge CFDictionaryRef)keyPairAttr, &publicKeyRef, &privateKeyRef);
-
Re: Keychain error -34018 is Back
Kensei Sep 15, 2016 3:21 PM (in response to theory)Same here. Works on device, not in simulator.
-
Re: Keychain error -34018 is Back
hacknicity Sep 19, 2016 3:25 AM (in response to theory)I found something interesting...
As others have reported, my app would always fail on SecItemAdd() with -34018 on the simulator but work fine on a device. I was about to add the 'Share keychain' entitlement as a workaround but noticed that Xcode 8 was prompting me to add the 'Push Notification' entitlement (that entitlement is now required to use push notificaitons on iOS 10 as the permission is taken from the entitlement rather than the provisioning profile in earlier versions). This *created* an entitlements file because the app didn't have one before. And without adding the 'Share keychain' entitlement the app suddenly started working! No more -34018. I've reverted back and forth and it seems pretty deterministic: no entitlements file gives -34018; entitlements file works.
So, my testing seems to show that SecItemAdd fails if there's no entitlement file, and works if there is one! Perhaps all the developers adding 'Share keychain' entitlement never had an entitlement file before and it is the creation of the file rather than the specific entitlement that fixes the problem?
-
Re: Keychain error -34018 is Back
friendOfOdin Sep 19, 2016 4:46 AM (in response to theory)Yesterday I had same problem -34018 error in keyChain class. Xcode Version 8.0 (8A218a), iOS 10.
I solved this problem by downloading iOS 9.3 simulator. Now I simply start simulator with iOS 9.3 and the error disappears. I’ll wait until Apple solves this problem and only then I am going to start using iOS 10 Simulator.
-
Re: Keychain error -34018 is Back
hacknicity Sep 19, 2016 5:42 AM (in response to friendOfOdin)Do you have an entitlements file for your app?
-
-
Re: Keychain error -34018 is Back
hacknicity Sep 19, 2016 10:55 AM (in response to friendOfOdin)In my earlier comment I found just adding an entitlements file fixed the problem. it doesn't seem to matter what the entitlement is. I've not tried creating a plist with no actual entitlements, but even an "empty" file might work (it's not literally an empty file because it has the plist xml structure, but it would have no actual entitlements inside).
-
Re: Keychain error -34018 is Back
friendOfOdin Sep 19, 2016 11:12 AM (in response to hacknicity)Just now I create entitlements file and .... everything works! (I meen in iOS 10 simulator) Thank you @hacknicity to very usefull advice. This file consist of two entries
<key>aps-environment</key> <string>development</string>
-
Re: Keychain error -34018 is Back
hacknicity Sep 19, 2016 1:16 PM (in response to friendOfOdin)be careful of side effects of enabling push notifications. You might get problems submitting the app for review or at runtime in production builds. I was able to add that entitlement for my app because I really do use push notifications.
-
-
-
-
-
-
Re: Keychain error -34018 is Back
peko Sep 19, 2016 7:06 AM (in response to theory)Thx @hacknicity,
just creating entitlements file, fixes it for simulator.
-
Re: Keychain error -34018 is Back
fighting300 Nov 3, 2016 1:34 AM (in response to theory)I use a library project in my application, we're unable to test on simulator because of this too (Xcode 8 GM).
It don't work with enabling Keychain sharing. Is there anyone encounter problem like me?
-
Re: Keychain error -34018 is Back
matwu Nov 10, 2016 12:58 AM (in response to fighting300)I have same issue in my static-library project. (Xcode 8.1 8B62)
-