Introduction
Jabber Guest for iOS includes a tutorial for getting quickly started with the high-level SDK.
Quick Start
Overview
This tutorial describes how to create a new application by using the CJGuestCallViewController. This high-level SDK object is useful for demo purposes.
Requirements
Refer to the requirement in the Developer Guide.
Steps
The following steps show how to piece together the application.
Create A New Project
This new project should be built from the iOS Empty Application template.
- Open Xcode.
- From the File menu, select New and then New Project. A new window appears.
- From the iOS section, select Application, select Empty Application, and then click Next.
- On the next window:
- Enter a Product Name and Company Identifier.
- Enter a Class Prefix of CJS.
- From the Device Family pop-up menu, select Universal.
- Uncheck all check boxes.
- Click Next.
- Navigate to the folder you want your project created in and click Create.
Add the SDK to Your Project
The installation instructions for the SDK can be found in the Developer Guide. 3. Add CJGuestCallViewController
In CJSAppDelegate.m, modify application:didFinishLaunchingWithOptions:
to create an instance of CJGuestCallViewController, set it with your specific server and uri values, and show it.
#import <JabberGuest/JabberGuest.h>
@implementation CJSAppDelegate {
CJGuestCallViewController * jabberGuestController;
}
- (BOOL)application:(UIApplication *)didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
jabberGuestController = [[CJGuestCallViewController alloc] init];
jabberGuestController.serverName = @"YOUR_SERVER";
jabberGuestController.toURI = @"YOUR_ADDRESS";
UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:jabberGuestController];
[[self window] setRootViewController:navController];
[self.window makeKeyAndVisible];
return YES;
}
In CJSAppDelegate.m, modify applicationDidEnterBackground:
to have CJGuestCallViewController handle background transitions.
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[jabberGuestController enterBackground];
}
In CJSAppDelegate.m, modify applicationWillEnterForeground:
to have CJGuestCallViewController handle foreground transitions.
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[jabberGuestController enterForeground];
}
In CJSAppDelegate.m, modify applicationWillTerminate:
to have CJGuestCallViewController handle the application terminating.
- (void)applicationWillTerminate:(UIApplication *)application
{
[jabberGuestController terminate];
}
- Build and Run the Application
Build and run the application on your iOS device. You should be able to play a video call to the URI you set in the
application: didFinishLaunchingWithOptions:
method.
Storyboards
Overview
This tutorial describes how to create a new application using storyboards by using the CJGuestCallViewController. This high-level SDK object is useful for demo purposes.
Requirements
The requirements for the SDK can be found in the Developer Guide.
Steps
The following steps show how to piece together the application.
Create A New Project
Create a new project in Xcode and use the Single View Application template.
Add the SDK to Your Project
The installation instructions for the SDK can be found in the Developer Guide.
Add CJGuestCallViewController
- From the Project Navigator, select Main_
.storyboard. If you selected to create a universal app you will see a storyboard for both iPad and iPHone. - Select the View Controller Scene from the Document Outline.
- Select Editor > Embed In > Navigation Controller to add a master navigation controller.
- Select the View in the storyboard and drag a Label from the Object Library and place it in the middle of the View.
- Change the label text to Guest Call Storyboard View.
- Drag a Bar Button Item from the Object Library to the View Controller’s Navigation Item at the top left and change the title to Video Support.
- Drag a View Controller from the Object Library to the storyboard.
- Change the Class of the View Controller (under Identity Inspector) to CJGuestCallViewController.
- Hold down the Ctrl key and drag a link from the Video Support button to the Guest Call View Controller to create a segue.
- Select the segue and from the Attributes Inspector change the Identifier to StartJabberGuest.
Your completed storyboard should look like this.
In your ViewController.m add prepareForSegue to handle the StartJabberGuest segue, and implement a delegate method to dismiss the Guest Call View Controller once the call is finished.
- From the Project Navigator, select Main_
#import "YourViewController.h"
#import <JabberGuest/JabberGuest.h>
@interface YourViewController () <CJGuestCallViewControllerDelegate>
@end
@implementation YourViewController
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"StartJabberGuest"]) {
CJGuestCallViewController * jabberGuest = [segue destinationViewController];
jabberGuest.serverName = @"your.server.name";
jabberGuest.toURI = @"your.uri";
jabberGuest.delegate = self;
}
}
- (void)callFinishedForCallController:(CJGuestCallViewController *)callController
{
callController.navigationController.navigationBarHidden = NO;
[callController.navigationController popViewControllerAnimated:YES];
}
@end
- Build and Run the Application
Build and run the application on your iOS device. You should be able to play a video call to the URI you set in the
prepareForSegue: sender:
method.
Sample Apps using Objective-C
Overview
The sample apps described below are bundled with the SDK, both to assist with learning and to provide a starting point for some development projects.
Refer to the ReadMe file within each project for instructions to follow to build the sample app.
CJGuestCallController
An application that uses the CJGuestCallController component of the Jabber Guest SDK in a navigation controller.
It also implements the CJGuestCallControllerDelegate methods.
There is also a Swift implementation of this sample app under the samples/swift folder
LiveSupport
An application that uses the views of the Jabber Guest SDK to allow users to contact live support while they continue to use the app.
It makes use of the CJCallBarView. It directly uses the CJGuestCall for the rest of its functionality.
There is a Swift implementaion of this sampple app (CustomerSupport) under the samples/swift folder.
StoryboardExample
An application that uses an Xcode storyboard to implement a segue into the the Guest Call View Controller a component of the Jabber Guest SDK.
A Storyboard has been created for both the iPad and iPhone.
URLRequest
A simple single view application that shows how to wire a button to open the Jabber Guest demo app from inside another application via a URL request.
ABCBank
Bank application used to demo Jabber Guest SDK for iOS at conferences.