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 ();

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 LoginWithURL (string url, string userid,UIViewController currentView);

Return type: void
Usage:

this._msgSDK.LoginWithURL("https://yoursitename.com/cometchat", "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 LoginWithURL (string url, string username, string password, UIViewController currentView);

Return type: void

Usage:

this._msgSDK.LoginWithURL("https://yoursitename.com/cometchat", "demo1", "user1", this);

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

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

Note : The user name will be displayed at 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 clears user data

void Logout ();

Usage:

this._msgSDK.Logout ();

Not finding what you need?

The CometChat team is here to help!