# CortexClientDelegate protocol

```cpp
#import <EmotivCortexLib/CortexClient.h>
```

```objectivec
@protocol CortexClientDelegate
@required
- (void)authenticationFinished:(NSString* )authenticationCode 
                     withError:(NSError*)error;
- (void)processResponse:(NSString*)responseMessage;
@end
```

Your application must implement this protocol and use it as a delegate for the class [CortexClient](https://emotiv.gitbook.io/cortex-library-for-mobile/objective-c-api/cortexclient-class).

### authenticationFinished

```objectivec
- (void)authenticationFinished:(NSString* )authenticationCode
                     withError:(NSError*)error;
```

The Cortex Library calls **authenticationFinished** after you called the function [authenticate](https://emotiv.gitbook.io/cortex-library-for-mobile/cortexclient-class#authenticate). If there is no error, then the parameter **authenticationCode** contains a code that you can use to call the JSON API method [loginWithAuthenticationCode](https://emotiv.gitbook.io/cortex-library-for-mobile/jsonapi/loginwithauthenticationcode).

## processResponse

```objectivec
- (void)processResponse:(NSString*)responseMessage;
```

The argument **responseMessage** is a JSON message sent by the Cortex library.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://emotiv.gitbook.io/cortex-library-for-mobile/objective-c-api/cortexclientdelegate-protocol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
