How to integrate the RestComm iOS Client SDK in your app

RestComm iOS Client allows you to leverage the telecommunication features of RestComm. It offers a simple yet efficient Objective-C API that you can use to add rich communications capabilities to your iOS Apps. With this tutorial we will explore how to integrate the RestComm iOS Client SDK in your app. We will setup a sample App project in your development environment that will allow you to send and receive instant messages from your iOS device/simulator to the RestComm WebRTC client and back as well as initiate and receive calls. Notice that we are still working on the media part, so currently only the signaling for the calls is functional. This means that although you will be able to initiate and receive calls you won’t be able to actually talk just yet.

Step 1 – Clone the git repository

Fire up a terminal and clone our repo:

…in a directory of preference. Notice that although you could clone the repo directly from XCode we wouldn’t recommend it because the repo contains more than one sub-projects and you would need extra work to make XCode see the sub-project properly.

Step 2 – Open the sample project in XCode

Navigate to staging/test-ios-client and open the project file ‘test-ios-client.xcodeproj’ in XCode:

screenshot-finder

Step 3 – Choose a preferable device and build + run the project

With this sample App you are able to send messages through the ‘Message’ TextField. All messages, sent and received, will show up in a TextView below the ‘Message’ TextField -remember that with the iOS 7 controls the TextFields don’t have edges by default so you won’t be seeing anything there until you send or receive a message ๐Ÿ™‚

screenshot-msg

You can also over the counter xanax alternative initiate a call by entering the name of the party you wish to reach and pressing ‘Dial’ (remember that there is no media implemented yet). Similarly, you are able to receive an incoming call by pressing ‘Answer’ while ringing. Below I have just called alice:

screenshot-call

A quick tour on the RestComm Client iOS SDK code

You access the communication features of RestComm Client through two main entities: RCDevice and RCConnection. RCDevice is an abstraction of a communications device that can initiate/receive calls and send/receive messages. On the other hand, RCConnection represents a media connection between two parties. In order to get advantage of the event mechanism offered by RestComm Client you need to set a delegate to RCDevice which will be receiving any RCDevice or RCConnection events such as incoming calls and messages. You do that when initializing your RCDevice with [RCDevice initWithCapabilityToken: delegate:]. In our example we use our main View Controller as a delegate.

If you want to initiate a media connection towards another party you use [RCDevice connect]. This method returns an RCConnection object representing the new outgoing connection. From then on you can act on the new connection by applying RCConnection methods on the handle you got from [RCDevice connect]. For example you can call [RCConnection disconnect] to disconnect it.

On the other hand, if there’s an incoming call you will be notified by device:didReceiveIncomingConnection delegate method. At that point you can choose to [RCConnection accept] it or [RCConnection reject] it.

As far as instant messages are concerned you can send a message using [RCDevice sendMessage] and you will be notified of an incoming message via device:didReceiveIncomingMessage delegate method.

Well, that’s all for now. Have fun!