ContextAttributes
@objc
public class ContextAttributes : NSObject
A mechanism to provide optional data about the user. For the information to be used, it must be set before the call is started.
Controller.shared.contextAttributes.setValue("Macy Williams", forKey: "fullName")
Controller.shared.contextAttributes.setValue("macy.williams@example.com", forKey: "email")
Controller.shared.contextAttributes.setValue("+16505550121", forKey: "phone")
Controller.shared.contextAttributes.setValue( "San Francisco CA, United States", forKey: "location")
Controller.shared.contextAttributes.setValue( "Basic Guidance", forKey: "appLocation")
Note that some data, such as the OS and the device type are automatically sent with the call.
-
Remove all previously configured context attributes.
Declaration
Swift
@objc public func removeAllObjects()
-
Add a new context attribute.
Declaration
Swift
public override func setValue(_ value: Any?, forKey key: String)
Parameters
value
a next context attribute value
forKey
the context attribute key For example
Controller.shared.contextAttributes.setValue(“Macy Williams”, forKey: “fullName”)
-
Get the value of a context attribute.
Declaration
Swift
public override func value(forKey key: String) -> Any?
Parameters
forKey
the context attribute key
Return Value
the value for the key or nil if none has been set