I am developing a macOS app with SwiftUI which adds a generic password to the keychain. I have a unit test that tests my keychain utility function (see below). The unit test that covers this function always throws the error on Xcode Cloud but works perfectly fine locally on my mac.
let query = [
kSecClass: kSecClassGenericPassword,
kSecAttrService: service,
kSecAttrAccount: account,
kSecValueData: passwordData,
]
let added = SecItemAdd(insert as CFDictionary, nil)
guard added == errSecSuccess else {
throw error
}