Ready UI

To access MessageSDKBinding.iOS binding library

Include the MessageSDKBinding.iOS in the .cs file of your ViewController.

include-file

1. Initialize MessageSDK object

private MessageSDK _msgSDK;
this._msgSDK = new MessageSDK ("API-KEY");

2. Login to CometChat
Login to CometChat on your website by any of the 2 available methods. Also make sure that your chatlogin() function in integration.php should be configured to handle any of the login mechanisms you opt for.

a) You can login to CometChat using the userID. All data related to the previous user will be cleared.

void LoginWithID (string userid, UIViewController currentView);

Return type: void
Usage:

this._msgSDK.LoginWithID("5", this);

b) You can also login to CometChat using the username and password. All data related to the previous user will be cleared.

void LoginWithUsername (string username, string password, UIViewController currentView);

Return type: void

Usage:

this._msgSDK.LoginWithUsername("user1", "user123", this);

3. Launch chat with window
In order to open the chat window of a specific user, use chatWith method. The syntax for this function is as follows:

void ChatWith (string userid, bool flag, UIViewController currentView);

Note : The username will be displayed on the status bar if the user is online.

Return type: void

Usage:

this._msgSDK.ChatWith("6", true, this);

4. Logout
Calling this function will end the current session and clear the user data.

void Logout ();

Usage:

this._msgSDK.Logout ();

Not finding what you need?

The CometChat team is here to help!