Setting up the Connect SDK for iOS app development
This article describes how to set up the Connect SDK in the Xcode development environment so that the API for the Connect SDK can be used in iOS apps that are being developed.
Prerequisites
Only apps running on iOS 9.x or later can use the Connect SDK. The iOS app that uses the Connect SDK must be developed by using either the Swift or Objective-C programming language.
Make sure that you have already done the following tasks:
- Read the Connect SDK overview article.
- Read the Connect SDK AppleDocs which describe the API.
- Developed iOS apps:
- In the Xcode (9.2 or later) integration development environment (IDE)
- Using the Swift or Objective-C programming language
Add the Connect SDK to Xcode
You add the Connect SDK to Xcode as a framework. For more information, see Adding the Connect SDK as a framework.
setAuthenticationHeader()
function.Optional steps
After you configure the Connect SDK, you can also perform the following optional tasks.
Verify that the Connect SDK is configured
You can test that the Connect SDK has been correctly configured by adding the following code to the iOS app that you are creating. Refer to the following instructions.
Start using the Connect SDK
To start using the Connect SDK:
- Add the
ConnectSDK
framework import statement to your Swift source file:import ConnectSDK
- Initialize the Connect SDK. Remember to replace the <server URL> string with your Pega 7 Platform application instance URL:
let urlString = "http://test.pega.com:8080/prweb/api/v1"; guard let serverURL = URL(string: urlString) else { fatalError("Please set valid url for Pega API") } let pegaAPI = PMPegaApi(serverURL: serverURL)
- Authenticate by using the Connect SDK. Remember to replace the <user name> and <password> strings in the following code with your Pega Platform credentials:
pegaAPI.authenticationService.logIn(user: "user", password: "rules") { error in // code goes here }