SecAddSharedWebCredential(_:_:_:_:)
Asynchronously stores (or updates) a shared password for a website.
Declaration
func SecAddSharedWebCredential(_ fqdn: CFString, _ account: CFString, _ password: CFString?, _ completionHandler: @escaping (CFError?) -> Void)Parameters
- fqdn:
The fully qualified domain name of the website requiring the password.
- account:
The account name associated with this password.
- password:
The password to be stored. Pass
NULLto remove a shared password if it exists. - completionHandler:
A block invoked when the function has completed.
The block takes one argument:
errorIf the shared password was successfully added (or removed),
NULL; if not successful, a Cferror object that encapsulates the reason why the password could not be added (or removed). The error reference is automatically released after this handler is called, though you may optionally retain it for as long as needed.
Mentioned in
Discussion
This function adds a shared password item that will be accessible by Safari and apps that have the specified fully qualified domain name in their Associated Domains Entitlement. If a shared password item already exists for the specified website and account, it is updated with the provided password. To remove a password, pass NULL for the password parameter.
When this function is called, the system tries to get the site association file from the server. If the file is unavailable, the sever returns a 500-599 code.