Skip to content

Messaging Installation

Li Lin edited this page Aug 13, 2018 · 10 revisions

Overview

StraaS Messaging SDK provides a easy way to establish a Real-Time chatroom or message board

StraaSMessagingSDK only provides non-UI part of a chat room. We also provides ChatRoom to build Messaging-UI. This chapter will guide you to install whichever you want to use.

Install StraaSMessagingSDK

Requires Swift 4.0/Xcode 9.3 or later.

If you need Swift 3.x/Xcode 9.2(or eariler) use the v0.13.0.

CocoaPods

  • Suggest CocoaPods version upper than 1.1.0

  • Add following lines to your Podfile:

    use_frameworks!
    post_install do |installer|
        installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '4.0'
            end
        end
    end
    
    target '<YOUR_TARGET_NAME>' do
        pod 'StraaS-iOS-SDK/Messaging', '~> 0.7.1'
    end
    
  • Then run pod install in the command line. (You might need to do pod repo update before pod install.)

Manual Installation

Integrate Chatroom as message UI

To integrate our Message UI example, we suggest to use git submodule to make our UI example as a vendor. This can not only keep you tracking our latest UI update but also make you customized your own UI version.

Before we getting started, make sure you've read the previous chapter Use Chat Room, and set your STSSDKClientID properly.

Install the 3rd party libraries used by our sample into your project

Since Message UI example also use CocoaPods 3rd party libraries to complete a great experience sample, you should add those libraries into your project Podfile too.

   target '<#YOUR_TARGET_NAME#>' do
      pod 'StraaS-iOS-SDK/Messaging'
      pod 'SDWebImage'
      pod 'SlackTextViewController'
      pod 'TTTAttributedLabel'
   end

run Pod install in command line.

SDWebImage is used to handle cache image and asynchronous downloading.

SlackTextViewController is an awesome message UI library.

You can go to their github page to see what those libraries can achieve and how to modify if you want to build your own feature.

Integration with Submodule

First, you should fork StraaS-iOS-sdk to your github account.

Use command line to go to your project folder which will use our UI example, and do:

  1. create a folder to manage submodule

mkdir <#your_submodules_files#>

  1. cd to <#your_submodules_files#> folder

cd <#your_submodules_files#>

  1. Add StraaS-iOS-sdk you just forked as submodule

git submodule add https://github.com/<#your_github_account#>/StraaS-iOS-sdk StraaS-iOS-sdk

Open your submodule file, you should see StraaS-iOS-sdk there waiting to serve you.

  1. Drag the ChatRoom directory into your project.

That's all you have to do. To see how to use message UI, here will tell you more details.