Trying to use SecCopyErrorMessageString to interpret errorCode. in swift :
var result: OSStatus result = SecItemAdd(query as CFDictionary, nil);
The SecCopyErrorMessageString function only became available on iOS in version 11.3. Prior to that, it could only be used on OS X.
SecCopyErrorMessageString