The Channel Developers

Welcome to the Channel Developers. You'll find comprehensive guides and documentation to help you start working with Channel-docs as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Installation

Installation

Prerequisite

  • iOS 11.0 or above
  • Swift 5.0 or above

SDK Latest Version

CocoaPodsCocoaPods Carthage compatibleCarthage compatible Swift Package Manager compatibleSwift Package Manager compatible

You can install Channel Talk IOS SDK easily to use Swift Package Manager, CocoaPods, or Carthage. Alternatively, you can manually add the dynamic framework to your project.

Cocoapods

Requirements

  • Xcode 12
  • CocoaPods >= 1.10.0.rc.1

🚧

Xcode version < 12

If xcode version is lower than 12,
See this page.
However, it is legacy and is not recommended.

🚧

CocoaPods version on Xcode12

Please make sure you have a CocoaPods version >=1.10.0.rc.1 installed.
You can check your version of CocoaPods with pod --version

If you are new to Cocoapods, please visit here to install and integrate it with your project.
Above 8.0.0 version, You don't need to include use_frameworks! to the Podfile Anymore.

Use the Latest Release(XCFramework version)

target YOUR_PROJECT_TARGET do
  pod 'ChannelIOSDK', podspec: 'https://mobile-static.channel.io/ios/latest/xcframework.podspec'
end

Use a Specific Version(XCFramework version)

target YOUR_PROJECT_TARGET do
  pod 'ChannelIOSDK', podspec: 'https://mobile-static.channel.io/ios/8.0.0/xcframework.podspec'
end

Use the Latest Release(Fat-Framework version)

target YOUR_PROJECT_TARGET do
  pod 'ChannelIOSDK', podspec: 'https://mobile-static.channel.io/ios/latest/framework.podspec'
end

Use a Specific Version(Fat-Framework version)

target YOUR_PROJECT_TARGET do
  pod 'ChannelIOSDK', podspec: 'https://mobile-static.channel.io/ios/8.0.0/framework.podspec'
end

And then run following command in console

pod deintegrate
pod install --repo-update

DSYM Support

We added DSYM support for CocoaPods for both framework(fat-framework, xcframework). CocoaPods will automatically pick up the dSYMs for improved symbolication.(CocoaPods 1.3.0 or later is required)

Carthage

ChannelIO is available as a Swift package.
We provide a URL to the public package repository that you can add in Xcode.
Additionally Carthage don't support XCFramework.

Quick Start

  1. If you are new to Carthage, install it from here with brew install carthage.
  2. Add ChannelIO as dependency to your Cartfile.
binary "https://mobile-static.channel.io/ios/latest/channeliosdk-ios.json"
  1. Run the following command in console under your project directory.
carthage update --platform iOS --no-use-binaries
  1. Drag the binaries from Carthage/Build/ into your application’s Xcode project.

Use the Latest Release

Fixed Cartfile like this.

binary "https://mobile-static.channel.io/ios/latest/channeliosdk-ios.json"

Use a Specific Version

Fixed Cartfile like this.

// Compatible version
binary "https://mobile-static.channel.io/ios/latest/channeliosdk-ios.json" ~> 8.0.0
// Specific version
binary "https://mobile-static.channel.io/ios/latest/channeliosdk-ios.json" == 8.0.0

Swift Package Manager

🚧

Carsh on Real IOS Device when running

This is a known issue in Xcode 12.

  1. Add a new copy files phase in your application’s Build Phase and Change the copy files phase’s destination to Frameworks
  2. Add a new run script phase script to your app’s target:
  3. Add the following script:
find "${CODESIGNING_FOLDER_PATH}" -name '*.framework' -print0 | while read -d $'\0' framework 
do 
    codesign --force --deep --sign "${EXPANDED_CODE_SIGN_IDENTITY}" --preserve-metadata=identifier,entitlements --timestamp=none "${framework}" 
done

Quick Statrt

  1. Select your project's Swift Packages tab
  2. Add the ChannelIO Swift package repository URL
https://github.com/channel-io/channel-talk-ios-framework
  1. Choose the package options version rule.

Use the Latest Release

Make Rules: Version: up to Next Major 8.0.0

Use a Specific Version

Make Rules: Version:Exact 8.0.0

Installation Troubleshooting

Running Error on Xcode 12

If you have a error on building on xcode 12, Add arm64 on Excluded Architecture of Target's Build Setting like below image.

Archaving Fail Error on Fat-framework

Add script on Target's Build Phase - New Run Script Phase

#!/bin/sh

echo "\n ⏱ Removing Unused Architectures \n\n\n"

exec > /tmp/${PROJECT_NAME}_archive.log 2>&1

FRAMEWORK="ChannelIO"

FRAMEWORK_EXECUTABLE_PATH="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/$FRAMEWORK.framework/$FRAMEWORK"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS

do

lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"

EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")

done

lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"

rm "${EXTRACTED_ARCHS[@]}"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

echo "\n ⏱ Removing Unused Architectures \n\n\n"
echo "\n\n\n 🏁 Completed removing unused architectures from your fat framework."
echo "\n\n\n 🔍 For more details please check the /tmp/${PROJECT_NAME}_archive.log file. \n\n\n"

LLDB: Couldn't IRGen Expression Debug Error

There are some swift debug bug on xcframework with cocoapod and xcode. We are working to resolve this issue quickly.
There is temporary solution

When an error such as 'ITMS-90680' or 'ITMS-90685' occurs in the environment using SPM and Extension

In an environment where SPM and Extension are used, errors such as'ITMS-90680' or'ITMS-90685' may occur during the App Store upload process.
This is an SPM error. When using an extension in an environment using a binary framework through SPM, the binary package is copied equally to the'Plugins' folder.

It can be solved by adding a script to Build Phases:

# https://forums.swift.org/t/swift-package-binary-framework-issue/41922
#!/bin/bash

COUNTER=0
while [ $COUNTER -lt "${SCRIPT_INPUT_FILE_COUNT}" ]; do
    tmp="SCRIPT_INPUT_FILE_$COUNTER"
    FILE=${!tmp}

    echo "Removing $FILE"
    rm -rf "$FILE"
    let COUNTER=COUNTER+1
done

In iOS 14 or later, the link or link button is not clicked

In iOS 14 or later, link navigation may not work if you change the default browser settings.
This is an iOS bug, which can be fixed by adding the below to info.plist.

<plist>
<dict>
  ...
  <key>LSApplicationQueriesSchemes</key>
  <array>
    <string>http</string>
    <string>https</string>
  </array>
  ...
</dict>
</plist>

After Installation - Update info.plist

There is some configuration you need to do manually in your project. After clicking your target, click Info tab, and add following keys and values.

KeyValue
Privacy - Camera Usage DescriptionAccessing to camera in order to provide better user experience
Privacy - Photo Library Usage DescriptionAccessing to photo library in order to provide better user experience
Privacy - Photo Library Additions Usage DescriptionAccessing to photo library in order to save photos
Privacy - Microphone Usage DescriptionAccessing to microphone to record voice for video

After Installation - Using ChannelIO

To use ChannelIO, you first need to obtain a pluingKey from Channel Desk. If you still do not have a pluginKey, please read this . With this key, you can start to use ChannelIO in your application immediately by using boot method. You can either start ChannelIO with anonymous user or registered user.

Import framework

First of all, import ChannelIO into a file where you want to use.

import ChannelIO
#import <ChannelIO/ChannelIO-swift.h>

Initialization on AppDelegate

Before you use any of methods from ChannelIO, make sure you call initialize method in application:didFinishLaunchingWithOptions: method.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    ChannelIO.initialize(application)
    return true
  }
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [ChannelIO initialize:application];
  return YES;
}

Initialization On SceneDelegate

❗️

Initialization(On SceneDelegate)

After initialization on AppDelegate,
If you use SceneDelegate, you must call initialzeWindow method on willConnectTo of SceneDelegate with 'strong variable'.(support ChannelIO version >= 7.0.8)

// SceneDelegate.swift

var channelWindow: UIWindow?

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
  guard let windowScene = (scene as? UIWindowScene) else { return }
  channelWindow = ChannelIO.initializeWindow(with: windowScene)
 }
//  SceneDelegate.m

@interface SceneDelegate ()
@property (strong, nonatomic) UIWindow * channelWindow;
@end

@implementation SceneDelegate


- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
  _channelWindow = [ChannelIO initializeWindowWith:(UIWindowScene *)scene];
}
@end

Start with an anonymous user

In order to boot with an anonymous user, you need to create a BootConfig object and set its pluginKey property with the pluginKey you obtain from Channel Desk. That's it! If you follow steps correctly, you will see the ChannelIO launcher button on your application.

let bootConfig = BootConfig(pluginKey: YOUR_PLUGIN_KEY)

ChannelIO.boot(with: bootConfig) { (bootStatus, user) in
    if completion == .success, let user = user {
        // success
    } else {
        // show failed reason from bootStatus
    }
}
BootConfig *bootConfig = [[BootConfig alloc] init];
[bootConfig setPluginKey:YOUR_PLUGIN_KEY];
[ChannelIO bootWith:bootConfig completion:^(BootStatus status, User *user) {
  if (status == BootStatusSuccess && user != nil) {
    // success
  } else {
    // show failed reason from bootStatus
  }
}];

Start with a registered user

Starting with a registered user isn't much different than an anonymous user. The difference is you only need to provide a memberId in BootConfig object.

🚧

Please set memberId when you are integrating for registered users.

We distinguish anonymous users and registered users based on memberId property in BootConfig.

You can pass any other information about the user into Profile object if you want (please refer Profile for more detail).

let profile = Profile()
profile.set(name: "Jason")

let profile = Profile()
  .set(name: USER_NAME)
  .set(propertyKey: KEY, value: VALUE)

let buttonOption = ChannelButtonOption(
  position: .left,
  xMargin: 16,
  yMargin: 23
)

let bootConfig = BootConfig(
  pluginKey: PLUGIN_KEY,
  memberId: MEMBER_ID,
  memberHash: MEMBER_HASH,
  profile: profile,
  channelButtonOption: buttonOption,
  hidePopup: false,
  trackDefaultEvent: true,
  language: .english
)

ChannelIO.boot(with: bootConfig)
Profile *profile = [[Profile alloc] init];
[profile setWithName:USER_NAME];
[profile setWithPropertyKey:KEY value:VALUE];

ChannelButtonOption *buttonOption = [[ChannelButtonOption alloc]
                                     initWithPosition:ChannelButtonPositionLeft
                                     xMargin:16
                                     yMargin:23
                                     ];

BootConfig *bootConfig = [[BootConfig alloc] init];
[bootConfig setWithMemberId:MEMBER_ID];
[bootConfig setMemberHash:MEMBER_HASH];
[bootConfig setProfile:profile];
[bootConfig setLanguage:LanguageOptionEnglish];
[bootConfig setWithUnsubscribed:YES];
[bootConfig setTrackDefaultEvent:YES];
[bootConfig setHidePopup:true];
[bootConfig setChannelButtonOption:buttonOption];

[ChannelIO bootWith:bootConfig completion:^(BootStatus status, User * user) { }];

Channel button visibility

We provide the default launcher and its visibility can be controlled by calling showChannelButton and hideChannelButton methods. You have to configure its visibility based on your view if you only want to display it on certain views.

ChannelIO.showChannelButton()
ChannelIO.hideChannelButton()
[ChannelIO showChannelButton];
[ChannelIO hideChannelButton];

Shutdown

To terminate ChannelIO (typically when a user logout from your application), simply call

ChannelIO.shutdown()
[ChannelIO shutdown];

Updated 27 days ago

Installation


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.