Calling our services requires an active session. Once you successfully initialise and retrieve a client object, call:
[client.services.session startSessionWithCompletion:^{
// session successfully created
} failure:^(NSError * _Nullable error) {
// error ocurred
}];
client.services.session.startSession(completion: { in
// session successfully created
}) { (error) in
// error
}
A session is also automatically created once you call any of the API services, so the above step is not always necessary.
To end the current session, call:
[client.services.session endSessionWithCompletion:^(CMPResult<NSNumber *> * result) {
if (result.error) {
// error occurred
} else {
BOOL success = [result.object boolValue];
if (success) {
// session successfully ended
}
}
}];
client.services.session.endSession(completion: { result in
if let err = result.error {
// error occurred
} else if let obj = result.object?.boolValue, obj == true {
// success
}
})