This error tends to occur when you call connectWithCompletion immediately after the app does Facebook/Google/LinkedIn/etc OAuth authentication. This causes a "Generation of key pair failed with result code -34018" error and Layer can't connect. This is because multiple SDK's are interacting with the Keychain at the same time.
We believe this issue has not been resolved in LayerKit v0.19.1. Please update to the latest SDK and try again.