FXKeychain icon indicating copy to clipboard operation
FXKeychain copied to clipboard

Shared Keychain iOS 8 Simulator on Yosemite

Open lukesteffen opened this issue 10 years ago • 3 comments

There is an issue using shared keychain items only in Yosemite using iOS 8 simulators. It appears that the kSecAttrAccessGroup is now needed in this specific configuration. Keychain calls that would previously fail when including the kSecAttrAccessGroup key with an error of -25243 are now successful. Further, the shared keychain does not appear to be globally available to the simulator requiring the kSecAttrAccessGroup key to be used. I simply commented out the simulator check in dataForKey: and setObject:forKey:

//#if TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
    if ([_accessGroup length]) query[(__bridge NSString *)kSecAttrAccessGroup] = _accessGroup;
//#endif

I haven't figured out any other way around this issue yet.

Update: I'm using OS X Yosemite v10.10.1 (14B25) and Xcode 6.1 (6A1052d)

lukesteffen avatar Nov 21 '14 18:11 lukesteffen

Interestingly, commenting out these checks also prevented a deadlock situation where the dataForKey: method would block in a semaphore_wait when calling out to SecItemCopyMatching on this line: OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *)&data); I experienced this in the iOS 8 simulator running in Yosemite 10.10.1 (14B25) w/Xcode 6.1.1 (6A2008a)

levigroker avatar Jan 02 '15 21:01 levigroker

I can confirm that commenting out these checks enables shared keychains on iOS 8 simulator on Yosemite. Thanks @Taurus084! What about a pull request?

ekurutepe avatar Jan 17 '15 14:01 ekurutepe

@ekurutepe Unfortunately this fix only works for the iOS 8 simulator on Yosemite. Commenting out the simulator exceptions causes the shared keychain access to fail on iOS 7 simulators on Yosemite and both iOS 7 & 8 simulators on Mavericks. Therefore, I don't see a reasonable resolution in code. Apple needs to make a fix.

ghost avatar Jan 18 '15 00:01 ghost