Getting Started with the Temasys SDK for iOS
A step-by-step guide to embedding Real-Time Communication features into your iOS application
This document is designed to help developers get started using the Temasys SDK for iOS to add video & voice calling, secure messaging, and more to their iOS application. Let’s get started!
Step 1: Create an Account on the Temasys Console (Skip to Step 5 if you have already created an account and generated an App key)
|The first step to getting started is to create an account on the Temasys Console here: https://console.temasys.io/register.
The Temasys Console is where you’ll be able to create an App Profile and get an App Key.Once you create an account, you will receive a verification email.
Click the link in the verification email, and then log into the Temasys Console to let the fun begin.
Step 2: Create an App Profile
Step 3: Select the Free Billing Option
|You’ll see a Billing screen with a variety of options, but you don’t need to worry about that right now.
You can select the Free option while you’re creating and testing your app.
The Free option, lets you test your code with up to 10 concurrent users and generate 3 associated keys at no charge.
Click Continue to confirm the Free option.
Once you’re ready to roll-out your app, you will want to come back to this screen and select the option that best fits your needs.
Step 4: Get an App Key
Step 5: Set up a new Xcode project workspace
These are the simple steps to set up an empty Xcode project.
We recommend you install the SDK via Cocoapods. If you don’t have Cocoapods installed, please follow these steps:
- Check that you have Xcode command line tools installed (Xcode > Preferences > Locations > Command line tools).
- If not, open the terminal and run -xcode-select –install . You can find more details here if needed:
- Install cocoa pods in the terminal: $ sudo gem install cocoapods. Cocoapods website: cocoapods.org. Create new Xcode project
- Close Xcode (.xcodeproj file)
Step 6: Install the Temasys SDK for iOS
pod initin the terminal, where the .xcodeprojfile file is located. This will create the podfile.
pod "SKYLINK"to your pod file, for the appropriate(s) target(s).
pod install. Wait for the terminal to output a message that will read something like “Pod installation complete!”
- You will see that there is 1 dependency from the Podfile, and 3 total pods installed.
Step 7: Configure Settings
- Open the .xcworkspace file and always work with this from now on (instead of the .xcodeproj file).
- For each target where you plan to use the Temasys SDK, go to Build settings (make sure “all” is selected) > Build Options > Enable bit code and set it to NO. This will avoid the “…does not contain bitcode” message.
- If you get the error “The resource could not be loaded because the App Transport Security policy requires the use of a secure connection”, edit your
info.plistby adding an
NSAppTransportSecuritykey as Dictionary. Then, add a sub-key named NSAllowsArbitraryLoads as boolean set to YES.
- Optionally, if you want your app to be able to process audio even when the users leaves the app or locks the device, just enable the VoIP background capability or the audio background capability in the target’s “capabilities” tab.
STEP 8: Initializing the Temasys SDK for iOS
The main idea is to prepare and create a connection to a room via the Temasys platform. After that, you will be able to send messages to the connection and implement the desired protocols to control what happens between the local device and the peers.
Temasys SDK for iOS provides 3 classes:
- SKYLINKConnection – the main class, the one you will be sending messages to
- SKYLINKConnectionConfig – to configure the SKYLINKConnection instance before you connect to a room
- SKYLINKPeerMediaProperties – used in delegates methods to get more information about the peers
Here is an example connection code:
// Creating configuration SKYLINKConnectionConfig *config = [SKYLINKConnectionConfig new]; config.video = YES; config.audio = YES; // Creating SKYLINKConnection self.skylinkConnection = [[SKYLINKConnection alloc] initWithConfig:config appKey:self.skylinkApiKey]; self.skylinkConnection.lifeCycleDelegate = self; self.skylinkConnection.mediaDelegate = self; self.skylinkConnection.remotePeerDelegate = self; // Connecting to a room [self.skylinkConnection connectToRoomWithSecret:self.skylinkApiSecret roomName:ROOM_NAME userInfo:nil];
Step 9: Implement Protocols
The common next step is to implement protocols. The Temasys SDK for iOS provides 7 protocols:
SKYLINKConnectionLifeCycleDelegate and the
SKYLINKConnectionRemotePeerDelegate are the most important. These will give you general details about the lifecycle and the peers that are joining and leaving your application. It is advised to implement them for all applications.
MediaDelegates need to be implemented if you are using the Temasys SDK for simply adding video/voice communication capabilities. Similarly, MessagesDelegate and FileTransferDelegate can be implemented based on whether you require messaging and data transfer capabilities for your application. You get the idea!
That’s about it. We can’t wait to see what you’ll create with Temasys technology!
We hope you enjoy getting started with the Temasys SDK for iOS! Have fun, share this and let us know if you run into any issues!
Here are some useful links:
Have a look at the iOS Sample App and its readme on Github. It provides simple example ways to build video calls, multi-party video calls, audio calls, chat rooms and file transfer rooms. https://github.com/Temasys/SkylinkSDK-iOS-Sample
This document applies to Temasys SkylinkSDK for iOS version 1.1.0