Keychain Crash
This troubleshooting guidance applies only to MobilePush SDK for iOS versions 8.0.13 and earlier.
Fatal Keychain Access exceptions occur if an application with an active SDK integration tries to access Keychain on a locked device secured with Face ID or passcode-based authentication. iOS Data Protection modes prevent the SDK from accessing these files.
These sections describe common Keychain Access exceptions and provide guidance on resolving them.
These are common occurrences of the errSecInteractionNotAllowed exception:
Fatal Exception: com.salesforce.security.keychainException dictionaryItemFromKeychain: Error attempting to look up keychain item: errSecInteractionNotAllowedFatal Exception: com.salesforce.security.keychainException setObject:forKey:: Error saving value to the keychain: errSecInteractionNotAllowed.Fatal Exception: com.salesforce.security.keychainException writeToKeychain: Error adding keychain item: errSecInteractionNotAllowed.
To resolve errSecInteractionNotAllowed exceptions, follow these steps.
-
Upgrade to SDK for iOS version 8.0.8 or later and Marketing Cloud SDK version 1.0.6 or later.
-
Before initializing the SDK, set the
setKeychainAccessErrorsAreFatalmethod tofalse.Setting this property to
falselogs the exception to the console instead of causing the app to crash.
You can encounter an error message that indicates a keychain access issue along with an unknown status code (-34018).
To resolve this issue, enable Keychain Sharing in the Signing & Capabilities pane in Xcode. When you enable Keychain Sharing, you don’t need to add identifiers specific to the SDK.
For an example of an ideal SDK implementation on iOS, see the iOS LearningApp.
Not all the code used in the LearningApp is required. Depending on your app, you can decide which parts to implement and which to ignore.