Getting Started with iOS
This overview will guide you through the steps required to integrate the BlackBerry Spark Communications Services SDK for iOS with your application.
Prerequisites
To build and run an application using the SDK, you will need:
- Xcode version 10.0 or later
- Deployment target of iOS version 11.0 or later
Add the SDK Framework to your Application
The SDK contains a framework that must be imported into your project:
Download & Configure the latest version of the SDK for iOS.
Copy the contents of the sdk
and sdk-release
folders to your Xcode project folder.
Drag BBMEnterprise.Framework
into the Frameworks folder of
your project in Xcode.
sdk
directory includes an x86_64
simulator
architecture and as such, is not suitable for submissions to the App
Store. The version in sdk-release
contains only the
arm64
architecture and is suitable for App Store submission.
When building your App Store release submission, to ensure the correct
version is embedded in your IPA.
On the left side of the screen, click the project.
Under TARGETS
, click the target for your application.
At the top of the screen, click Build Settings
.
In the search text field in the upper-right corner of the screen, type
Framework Search Paths
.
On the left side of the screen, drag the directory in which you placed
BBMEnterprise.framework
into the Framework Search
Paths
.
In the search text field in the upper-right corner of the screen, type
Bitcode
.
Next to Enable Bitcode
, in the drop-down list, select
No
.
Drag the BBMEnterprise.framework
into the Embedded
Binaries
section of the general settings for your application
target.
BBMEnterprise.framework
from
sdk
, not sdk-release
.
Set your Application's Capabilities
In Xcode, under TARGETS
, click the target for your
application.
At the top of the screen, click Capabilities
.
Ensure that the check boxes next to all the following modes are selected.
Mode Name | Description |
---|---|
Audio, AirPlay, and Picture in Picture | This allows your application to play audio alerts when a user receives voice or video calls. Each user must grant permission for your application to use the microphone prior to using it for the first time. |
Voice over IP |
This allows your application to make and receive voice and video calls.
PushKit is used for handling push notifications for incoming VoIP
calls. VoIP background mode is obsolete in the versions of iOS
supported by the SDK.
|
Remote Notifications |
This allows your application to display incoming messages while the application is running in the background. This following lines will add the necessary background modes to your application's Info.plist. See Apple's programming guide on Background execution for additional information. <key>UIBackgroundModes</key> <array> <string>voip</string> <string>audio</string> <string>remote-notification</string> </array> |
Start the SDK
To start the SDK service, see the example code below.
// Start the SDK service by supplying your application's domain. [[BBMEnterpriseService service] startService:@"Your SDK Domain ID" environment:kBBMConfig_Sandbox completionBlock:^(BOOL success) { // Update the UI once there is a response. // Perform any appropriate actions here such as display existing chats. // Once the BBM Enterprise service has successfully started, // you may now invoke the sendAuthToken API. }];
Substitute the ID of the SDK domain that you created earlier
for Your SDK Domain ID
.
The environment
parameter will determine which servers the SDK
will connect to.
kBBMConfig_Sandbox
as the environment
. Your
application that you ship to customers should
specify kBBMConfig_Production
as the environment
.
Authentication
Your application is responsible for providing access tokens to the SDK with
the BBMAuthTokenMessage
APIs. These tokens are used to identify, authenticate, and authorize your
users.
As described in the Identity
Providers guide, you can configure your domain in the sandbox to have
user authentication disabled. Your application must still provide tokens
using the BBMAuthTokenMessage
APIs, but instead of getting them from a real identity provider, your
application generates its own unsigned JWT tokens.
By default, all examples expect your domain to have user authentication disabled. Some examples may optionally be configured to use Google Sign-In or Azure Active Directory as an identity provider.
Key Management
By default, all examples use the BlackBerry Key Management Service which provides automatic management and synchronization of keys. The Support library comes with code that you can use for using Cloud Key Storage with Google Firebase or Azure Cosmos DB.
Support Library
Source code for several helper classes can be found in the Support library. Classes and interfaces for handling authentication, key management, and user management are provided. Where applicable, these classes are written to allow you to utilize your own back-end storage or authentication scheme. Example implementations based on Google Sign-In/Firebase and Microsoft Azure Active Directory are provided and used throughout the example applications.
If you use the support code in your application, please note the following.
- A generic Swift bridging header is included, but is written specifically to support the example applications. You might need to modify this to include or exclude the classes you wish to use. If you are not using Firebase or Google Sign-In, those specific sections should be omitted for example.
- If your application is a Swift application, you must add the supplied bridging header's path to the Objective-C Bridging Header bridging headers location in your project properties or add the relevant classes to your existing bridging header.
- You must add the correct header search paths for the support classes.