Authentication
Last updated
Was this helpful?
Last updated
Was this helpful?
There is a setup call that you need to do before registration or login. You can get your by signing up on . In your AppDelegate
, first import Kommunicate
:
Then, in the application:didFinishLaunchingWithOptions:
method, setup Kommunicate
as shown below
Kommunicate.setup(applicationId:)
Once you complete the pod installation, close the project and open .xcworkspace
file then build the project to avoid the above mentioned error.
Convenient methods are present in Kommunicate class to register a user on Kommunicate.
Currently we support two different types of users on our iOS SDK:
A random Id will be assigned as an userId
if you don't have any information about the users. So first get the userId for an anonymous user as described below and, pass the same in .
Note: The above line should be passed in the registration process.
You don't have to store this id on your side. In the section, we show how to check if the user is already logged in.
For collecting user contact information before initiating the chat, show the Pre chat view like this:
Confirm your ViewController
to the KMPreChatFormViewControllerDelegate
to get the callbacks when a user taps the submit or close button:
If the user is logged in your app then you can pass the user information in this way.
To register a user to the Kommunicate server, use below method from Kommunicate
class:
Create a KMUser object and pass it to the registerUser
method:
Sometimes, you may need to pass additional details for the user apart from the already existing properties of KMUser. You can pass the additional details in metadata of the KMUser object.
To check if user is already logged in, use below API:
Note: To avoid calling in registration everytime use isLoggedIn
to check if the user is already logged in or not.
Check out the where you will get the details for creating and launching a conversation.
to get real-time updates.