Skip to content

Migration From .framework to SDKs

rohitphogat19 edited this page May 13, 2019 · 6 revisions

To migrate to SDKs, follow these procedure

Remove Old Framework

  1. Remove Existing PrimeMessenger.framework file from your Project.
  2. Clean your project.
  3. Remove import PrimeMessenger from your code from files where you are using it.
  4. Remove old integration code from your project.

Installing Pods

Open your podFile and Install following pods for Channelize to run. It will install all pods required by Channelize

pod 'ChannelizeUI'
pod 'ChannelizeAPI'
pod 'Chatto',  :git => 'https://github.com/BigStepTechnologies/Chatto', :branch => 'bigstep/v1.0'
pod 'ChattoAdditions',  :git => 'https://github.com/BigStepTechnologies/Chatto', :branch => 'bigstep/v1.0'

Commands to use Channelize

To import Channelize where you want, use following command

import Channelize_API
import Channelize

Configuring and Connecting

Configure Channelize

To configure Channelize you need to add the following code in didFinishLaunchingWithOptions function of your project's AppDelegate.swift file

Channelize.configure()

Login into Channelize Server

Channelize.main.login(username: email, password: password){(user,error) in
    if error != nil {

    }else{

    }
}

Launching Channelize

Make Sure Channelize.main.currentUserId() != nil before Launching Channelize

if let navigationController = UIApplication.shared.keyWindow?.rootViewController as? UINavigationController{
   CHMain.instance.launchApp(navigationController: navigationController, data: nil)
}

Launching Channelize for Any Specific User

let userData : [AnyHashable:Any] = [AnyHashable("userId"):USER_ID]
if let navigationController = UIApplication.shared.keyWindow?.rootViewController as? UINavigationController{
   CHMain.instance.launchApp(navigationController: navigationController, data: userData)
}

Setting User Online and Offline

Setting User Offline

Channelize.setUserOffline(completion: {(status,error) in
        
})

Setting User Online

Channelize.setUserOnline(completion: {(status,error) in
        
})

Logout from Channelize

Channelize.main.logout()