Latest1.3.0
Homepagehttps://github.com/circuit/circuit-ios-sdk
LicenseApache 2.0
Platformsios 10.0
DependenciesSocketRocket
FrameworksJavaScriptCore, AudioToolbox, AVFoundation, VideoToolbox, CoreMedia, GLKIT
Authors

Build Status
Version
License
Platform

Circuit iOS SDK

Introduction

Welcome to the Circuit iOS SDK. You can use the provided SDK to build a text or media mobile application for iOS.

Prerequisites

Installation

CircuitSDK is available through CocoaPods. To install CircuiSDK you need to install Git Large File Storage by running these comamnds:

brew install git-lfs
git lfs install

Be sure to restart your console after installing Git LFS

You can easily try our sample app by running the following command in your terminal window:

pod try CircuitSDK

To use it simply add the following line to your Podfile:

pod 'CircuitSDK'

Example

You can find the sample application in the iOS Sample App directory. If you try to run the application, you won’t be able to logon. You must add your client id and client secret and install pods. In the terminal navigate to the CircuitKit folder and run the following command:

pod install

This will install the pods and create a CircuitKit.xcworkspace, open that file instaead of the CircuitKit.xcodeproj. In the Sample/Resources folder open AppDelegate.swift, here you can add your client id and client secret. Press the run button

Authorization

If you do not have any client credentials first sign up for a developer account here

Once your account is approved navigate to Circuit App Registration and follow the instructions to obtain the credentials

Once you receive them you are ready to run the sample application and create your own.

Here are some snippets to get you started.

initializeSDK

It’s a good idea to initialize the SDK when the application launches,
this can be done in the AppDelegate file.

Application scope should be a comma delimited string that can contain any of
the following

SCOPE
ALL
READ_USER_PROFILE
WRITE_USER_PROFILE
READ_CONVERSATIONS
WRITE_CONVERSATIONS
READ_USER
CALLS

We use a framework called AppAuth to help with OAuth 2.0 authentication.

AppAuth takes your client id and client secret and returns to you an access token,
you can the use this access token to logon.

See AppAuth-iOS for examples using AppAuth

Remember to set your redirectURI you created when registering your application,
this redirectURI tells AppAuth how to get back to your application after
authentication has completed.

[client initializeSDK:@"ADD CLIENT_ID"
                    oAuthClientSecret:@"ADD CLIENT SECRET"
                    oAuthScope:@"ADD OAUTH SCOPE"];
CKTClient().initializeSDK("ADD CLIENT ID",
                            oAuthClientSecret:"ADD CLIENT SECRET",
                            oAuthScope:"ADD OAUTH SCOPE")

Event Handling

Event handling is already setup in the SDK. All you have to do to provide
event handling to your application is add some observers where you want to listen
to specific events.

EventTypeDescription
CKTNotificationBasicSearchResultsstringAsynchronous search results for startUserSearch or startBasicSearch
CKTNotificationCallEndedstringFired when a call is terminated.
CKTNotificationCallIncomingstringFired when an incoming call is received.
CKTNotificationCallStatusstringFired when the call state, or any other call attribute of a local or remote call changes.
CKTNotificationConnectionStateChangedstringFired when the connection state changes.
CKTNotificationConversationCreatedstringFired when a new conversation is created for this user. This can be a brand new conversation, or being added to a conversation.
CKTNotificationConversationUpdatedstringFired when an existing conversation is updated.
CKTNotificationItemAddedstringFired when a new conversation item is received. Note that the sender of an item will also receive this event.
CKTNotificationItemUpdatedstringFired when an existing conversation item is updated.
CKTNotificationReconnectFailedstringFired when automatic reconnecting to the server fails.
CKTNotificationRenewTokenstringFired when token has been renewed after session expiry. Error included on failure.
CKTNotificationSessionExpiresstringFired when session expires.
CKTNotificationUserPresenceChangedstringFired when the presence of a subscribed user changes.
CKTNotificationUserSettingsChangedstringFired when one or more user settings for the logged on user change.
CKTNotificationUserUpdatedstringFired when the local user is updated.

Adding Observers

[[NSNotificationCenter defaultCenter] addObserver:self
                                        selector:@selector(itemAddedToConversation)
                                        name:CKTNotificationItemAdded object:nil];
NSNotificationCenter.defaultCenter().addObserver(self,
                            selector:#selector(itemAddedToConversation),
                            name:CKTNotificationItemAdded, object: nil)

To listen for events you need to add observers to your application logic. You
do this using Apple’s Notification Center if you have never used NSNotificationCenter
you can find more information on it here

In the example we are watching for an event called CKTNotificationItemAdded which when triggered
will fire a method called itemAddedToConversation

Terms of Use

By downloading and running this project, you agree to the license terms of the third party application software, Unify products, and components to be installed.

The third party software and products are provided to you by third parties. You are responsible for reading and accepting the relevant license terms for all software that will be installed. Unify grants you no rights to third party software.

License

Unless otherwise mentioned, the samples are released under the Apache license.

Copyright 2017 Unify Software and Solutions GmbH & Co.KG.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Help us improve the SDK

Help us improve out samples by sending us a pull-request or opening a GitHub Issue.

Copyright (c) Unify, Inc. All rights reserved. Licensed under the Apache license. See LICENSE file in the project root for full license information.

Latest podspec

{
    "name": "CircuitSDK",
    "version": "1.3.0",
    "summary": "Circuit iOS SDK to build a text or media mobile application for iOS",
    "description": "'The iOS SDK is the Circuit client, exposing a clear abstracted API for Circuit PaaS.n The iOS SDK is built upon the Circuit JS SDK.'",
    "homepage": "https://github.com/circuit/circuit-ios-sdk",
    "license": {
        "type": "Apache 2.0",
        "file": "LICENSE"
    },
    "authors": {
        "Unify Inc.": "https://www.unify.com"
    },
    "source": {
        "git": "https://github.com/circuit/circuit-ios-sdk.git",
        "tag": "1.3.0"
    },
    "social_media_url": "https://twitter.com/unifyco",
    "platforms": {
        "ios": "10.0"
    },
    "source_files": [
        "Source/Classes/**/*",
        "CKTNavigator/*.h"
    ],
    "public_header_files": "Source/Classes/**/*.h",
    "resource_bundles": {
        "CircuitSDK": [
            "Source/scripts/**"
        ]
    },
    "vendored_libraries": "Source/libCKTNavigator.a",
    "pod_target_xcconfig": {
        "OTHER_LDFLAGS": "-lc++ -ObjC"
    },
    "frameworks": [
        "JavaScriptCore",
        "AudioToolbox",
        "AVFoundation",
        "VideoToolbox",
        "CoreMedia",
        "GLKIT"
    ],
    "dependencies": {
        "SocketRocket": [
            "~> 0.4.2"
        ]
    }
}

Pin It on Pinterest

Share This