Skip to content

Chat SDK iOS: How do I link my podfile?

simonsmiley64 edited this page May 10, 2017 · 7 revisions

When adding the Chat SDK to your project you need to ensure that it has been correctly added to your podfile. This will depend on where and how you add it to your project so this tutorial will be explaining how to do it.

Chat SDK structure:

This is the best place to start for this explanation as it is worth understanding how Chat SDK fits together. You will see a number of different files:

  • ChatSDK: This folder contains the complete Chat SDK code. If you look inside you will see a number of folders. These folders are the separate chat modules. Each contains a specific type of code which has been split apart for simplicity.
  • ChatSDKFirebase: This folder probably only contains a podspec. It is used for if you want to add additional features to the Chat SDK. You would then add the typingIndicator feature to this folder to quickly enable the functionality
  • ChatSDKModules: This folder is used for adding specific functional modules to the Chat SDK

The most important folder to be aware of is the ChatSDK folder as this contains all the standard code for the chat. This folder contains module folders for each area of the code and you will see each folder contains an individual podspec.

Linking the podfile and the pod spec

To correctly download all the Chat SDK code to your project with Cocoapods you need to create a direct link from your project podfile to the podspecs. All the required frameworks will then be automatically downloaded.

screen shot 2017-05-09 at 15 53 30

To do with you have two tools:

  • ../ This allows you to go out of the folder you are currently in
  • FolderName This allows you to go into a folder

Now, using these two tools you have to trace the path from your podfile to your individual podspec. Let's look at an example:

screen shot 2017-05-09 at 15 54 45

We want to do the following:

  • Go out of our project folder: ../
  • Go into our ChatSDK folder: ChatSDK/
  • Go into the next ChatSDK folder: ChatSDK/
  • Go into the appropriate module folder: ChatSDKCore/
  • We have now found our podspec

This means the podfile should look like this:

   pod "ChatSDKCore", :path => "../ChatSDK/ChatSDK/ChatSDKCore"
   pod "ChatSDKUI", :path => "../ChatSDK/ChatSDK/ChatSDKUI"
   pod "ChatSDKCoreData", :path => "../ChatSDK/ChatSDK/ChatSDKCoreData"
   pod "ChatSDKFirebaseAdapter", :path => "../ChatSDK/ChatSDK/ChatSDKFirebaseAdapter"

You can see the path is showing the podfile the correct directions to the podspec.

Depending on your project structure will determine the paths required. Your folder names could be different, the Chat SDK could be higher or lower in the project folders, the key thing is to always know where your Chat SDK podspecs are and be able to trace a direct line between them. Once you have this it should be easy to link them together.

Clone this wiki locally