iOS Presence SDK Integration Guide
##Important 2.2.0 notice:
Clear Text Removal: TM will be removing the clear text callbacks from the PSDK for account ID and email address and migrating fully to the token based callback system (You must make a separate request for the member id/email) using the access token. By using tokens that can only be decoded by approved partners, data security will be enhanced. Additionally, with the full migration to Modern Accounts, the token will be providing both the Archtics and HOST Account Information and so clients will be able to fully identify those users in their database.
example, maskedteam member id “teamname.17804314.1852513” will as of PSDK 2.2.0 return as “**.17804314.**”
If you need to fetch additional member information such as email or additional member identifiers using the oAuthToken (token) use the following Archtics API call
PSDK 2.1.0+ :
Experience SDK is now deprecated. Please remove any Experience SDK integrations in place in your app if using PSDK v2.1.0 or greater.
A.) Presence SDK 2.0.0+ now requires 2 additional frameworks (bringing the total frameworks to 4):
- Presense.framework (required)
- PresenceSDK.framework (required)
- TicketmasterFoundation.framework (required)
- ResaleSdk.framework (required)
All these files can be found in the Presence SDK distribution zip file.
B. If you are also integrating the Purchase SDK, you will need to use the new version 0.3.3+ available here: https://developer.ticketmaster.com/partners/certified-partners/mobile-app-developers/
C. If you are using the latest versions of Xcode 12.3+ you may see an error when compiling: Building for iOS Simulator, but the linked and embedded framework was built for iOS + iOS Simulator.
This is a known issue with non-XCFramework files (ie. “fat frameworks”) that we will soon fix. In the meantime, you can simply convert this error to a warning:
In your Project’s Build Settings, set “Validate Workspace” to “Yes”
Obtaining the Presence SDK Framework Files
We currently offer two different ways to install the Presence SDK into a project. You can either use CocoaPods or manually load the framework files.
To integrate PresenceSDK into your Xcode project using CocoaPods, specify it in your Podfile :
Presence SDK v2.3.1 iOS - Swift 5.3.0
pod 'TM-PSDK', '~> 5.3.0-2.3.1'
Download Presence SDK v2.3.1 iOS - Swift 5.3.0.
To get an insight on how to properly integrate the Presence SDK in your app or need help with a step below, you may download and reference this demo project.
What You Need
To integrate Presence SDK in your application, you will need the latest release of the Presence SDK for iOS.
Requirements for using Swift build
- To build, you must use Xcode 12.0+ and the iOS 12+ SDK
Requirements for using Swift 5.3.0 build
- To build, you must use Xcode 12.0+ and the iOS 12+ SDK
- Only Portrait Orientation Supported.
- iPhone support only.
- Minimum iOS 12.0, supported through iOS 14.x
- Offline Ticket Mode, which allows fans to access their tickets without a network connection, also requires that the app be accessible offline.
Beta versions of Xcode and swift are not supported.
- If migration is done from version prior to 1.28.0, it is required to access PSDK.getPresenceSDK() instead of PresenceSDK.getPresenceSDK().
- Instruction for integrators:
- Open find navigator in Xcode
- Choose Replace -> Regular Expression
- Paste text below as Regular Expression (?<!import)(?<!\/\/ )(\W)(PresenceSDK)(\W)
- Paste text below as Replace With $1PSDK$3
- Choose “Matching Case” option
- Press Enter
- Press Replace All
- Instruction for integrators:
Importing The SDK
Follow these simple steps to integrate and configure the SDK.
Note: If using CocoaPods, you can skip step 1.
Step 1: Drag and drop the PresenceSDK.framework, iOSExperienceSDK.framework, and Presence.framework into your project’s General -> Embedded Binaries settings (copy items if needed) (Skip step if using Cocoapods)
Step 2: Go to your app’s AppDelegate file and import the PresenceSDK module. You may delete the line where UIKit is being imported if you like. In the PresenceSDK module, UIKit is already being imported for you.
Step 3: Create a configurePresenceSDK() method inside your AppDelegate class. In this method, the account credentials and branding color will be configured.
Note: To get consumer key please create an account on https://developer.ticketmaster.com and register your app and it will generate a consumer key that can be used in the above method. Before you can use Presence SDK you will have to provide the generated consumer key together with consumer secret and redirect URI to Presence SDK support team so we can configure your app on our end!
Step 4: Call the configurePresenceSDK() method in the application(: didFinishLaunchWithOptions:) function.
Setting Up the Views
Now that we’ve imported the SDK into your project we can set up the views to display the UI.
In your storyboard, create a UIViewController or you may use the preset one provided by XCode when a new project is created. This UIViewController will be the starting point for Presence SDK.
Step 1: Drag and drop a UIView from the Object Library (located in the Utility panel) inside this UIViewController. For this UIView, in the Identity Inspector, change the class to
PresenceSDKView and Module to
PresenceSDK. Finally, set the constraints to the UIView to the edges of the View Controller.
Step 2: You will need to allow the user to logout in some fashion. We recommend using a UIBarButtonItem on the top right corner of the Navigation Item (see example below), but this is not required. You just need to reference the
PresenceSDK.getPresenceSDK().logOut() method wherever you want to call the log out function. Please note that the
.logout() call will log out both Host and Archtics accounts. Please see the Logout Methods section below under iOS Presence SDK Reference Guide lower on this screen for more information on logout functionality.
Example Logout Functionality: Like the UIView from step 1, drag and drop a UIBarButtonItem onto the Navigation Item of the View Controller. If the View Controller doesn’t have a Navigation item, you may drag and drop from the Object Library before adding a UIBarButtonItem. Double click the UIBarButtonItem’s title and type in “Logout”.
You may now run the application and if you have provided correct configuration, you will see a similar screen to the image below at startup.
IMPORTANT: If your project is in Objective-C, you will get a run time fatal error:
dyld: Library not loaded: @rpath/libswiftContacts.dylib
Referenced from: */Frameworks/PresenceSDK.framework/PresenceSDK
Reason: image not found. To fix this error, in your project build settings, set
Always Embed Swift Standard Libraries under
NOTE: Further setup required. You still need to configure your application to handle PresenceSDK events.
Configuring Your ViewController
Note: This is a basic example for configuring the ViewController
Step 3: Import the PresenceSDK module. Again, UIKit is imported automatically when importing PresenceSDK, so if you like, you may delete the
import UIKit code-line.
Step 4: Create an
IBOutlet to the UIView you setup in step 1. When the outlet is created, please make sure the view is of type PresenceSDKView. Make sure that you connect this new outlet to the PresenceSDKView in the storyboard. If you used our example logout, remember to also, create an
IBAction method called
logout for the UIBarButtonItem you setup in step 2. In the method
logout, call the
logOut method in the PresenceSDK.
Step 5: Conform your ViewController to PresenceLoginDelegate and implement the required and optional protocol methods:
Step 6: Start PresenceSDK inside viewDidLoad() life cycle method.
We’ve also added the ability to start the login flow for specific backend environments. Please see the example below:
Step 7: If you need to get information for logged in member, you can use one the protocol methods.
Your ViewController’s implementation should look like this:
You have finish integrating PresenceSDK. Now, you may run the application, if everything was configured properly, you should see your tickets once you log in.
iOS Presence SDK Reference Guide
Jump to Order / Jump to Event
We have revamped our Jump to Order and Jump to Event logic. If event is found for given id, the method opens the list of tickets related to the found event. If order is found for given id, the method opens the list of tickets related to the found order.
Configure Brand Logo
Configure your brand logo with a UIImage object. This image will show up in the linking screen replacing the brand abbreviation. If you do not set a brand logo, then the abbreviation will work like before. Ex: TicketMaster becomes TM.
Specifying a Branding Color
Configure your branding color with a UIColor object
Configure Team Theme
Configure your team’s theme as
SDKTheme.Light (default) or
SDKTheme.Dark. The theme configuration lets PresenceSDK
know how to setup various UI elements to contrast with branding color. For example, if branding
color is in the dark color spectrum, a
Light theme configuration will color various UI elements white.
This will allow crucial UI element to be visible to the user.
Configure Login Item
Because Account Manager’s website only supports Forgot Password OR Create account, we have updated the SDK to do the same to remove confusion for your users. by default if not specified, you will see Forgot Password.
Suppress View After Login
Presence SDK gives the ability to allow the user to login, then immediately dismiss the
presenceSDKView. All that you need to do is utilize the following
PresenceLoginDelegate method which you implemented in step 5:
Once the user has successfully logged in, you can then dismiss or hide the
presenceSDKView for later viewing at your leisure.
onLoginSuccessful gets called for each account that is logged in. So in the instance of having a team and host account logged in, the
onLoginSuccessful delegate method will be fired off twice.
Following methods are provided for logging out of the Presence SDK. Logout is now asynchronous so
it is recommended to use the completion handlers or
PresenceLoginDelegate methods for notification
about logout completion.
A simple Logout handler function can look like this:
Note: Please note that a fan’s tickets will no longer be available on the device for offline viewing if logout is called, as it will clear the cache.
Check Login Status
Presence SDK also provides some helper methods for checking if user is logged into any of the supported services.
Presence SDK provides support for tracking user activity via its Analytics module.
For tracking user activity in the Presence SDK a separate class PresenceEventAnalytics is provided that lists all the user actions that are notified via local notifications together with the payload data.
Notifications - You can observe these notifications to receive updates from Presence SDK.
Payload Data for the Notifications – Only relevant information is sent out with the notification.
If you want to track ACTION_MANAGETICKETSCREENSHOWED event you should add an observer inside your ViewController’s viewDidLoad() method like this:
And the notification handler will look something like this:
Following section describes the steps you need to follow to prepare your app for the App Store.
PresenceSDK is packaged as a Universal binary and it contains binary packages for all valid architectures including ARMv* and x86. This is great for development as you can run your app on both devices and simulators but for App Store submission you need to strip the simulator packages from your App. To do this we have provided “strip_frameworks.sh” file, just add this file to the Run Script phase under your app’s Build Phases settings and it will do the work for you. Here is a screenshot of what your Build phases will look like after adding this file: