Contextual (iOS 11+) Setup¶
Due to lack of support of features like SwiftUI, Combine framework in iOS 11 new features will only be added to the iOS 13+ version of Contextual. If you need any support on iOS 11+ version of Contextual don’t hesitate in contacting us at support@contextu.al .
You can find an example of integration here
Prerequisites¶
- Deployment target between iOS 11.0 - iOS 12.
- Latest Xcode.
This setup assumes you have already setup your App Key on the Dashboard.
See requirements.
CocoaPod Integration Steps¶
Step 1 - Pod File¶
In pod file of your Application, add the following line:
1 2 |
|
Step 2 - Install¶
On the first time, run:
1 |
|
For updates and ensuring to get the latest version of the pointzi SDK, run:
1 |
|
Note
If you have used cocoapods previously, please run either "pod update" or "pod update pointzi --no-repo-update", this will ensure that the most recent version of the Contextual SDK is integrated.
If you are using Swift, add :
1 |
|
<Your_Project_Name>-Bridging-Header.h
.
Step 3 - Initialization¶
In your Application launch function, add pointzi registration.
If you are using Swift, Add the following code in AppDelegate
Swift
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
If you are using Objective-C, Add the following code in AppDelegate
Objc
1 2 3 4 5 6 7 8 9 10 |
|
Step 4 - Replace Base Classes¶
Replace the base ViewController classes and inherit from Contextual SDK classes as shown below.
From | To |
---|---|
UITableViewController | StreetHawkBaseTableViewController |
UIViewController | StreetHawkBaseViewController |
UICollectionViewController | StreetHawkBaseCollectionViewController |
For React Native, In your AppDelegate.m , Replace UIViewController with StreetHawkBaseViewController
1 2 3 4 5 |
|
Info
If your view controller overrides system functions, make sure you call super
.
Info
Replacing your view controller with the Contextual controller is essential for Contextual to function correctly. Please ensure that if you have multiple view controllers showing on the same screen to only replace the parent (top ViewController).
Step 5 - Set sh_cuid [Optional]¶
We recommend you also send a unique ID for the user so you can "tag" users from your backend system. This is called the sh_cuid.
If you would like to tag the user during registration just place the following snippet.
Swift
1 2 3 4 |
|
Objc
1 2 3 4 |
|
If you would like to tag the user at any other place in your application eg after login call, just place the following snippet.
Swift
1 2 |
|
Objc
1 2 |
|
Without Cocoapod¶
Dependencies¶
Before you can integrate the Contextual Framework you need to include the following libraries and frameworks in your project.
- libxml2.dylib
- UIKit
- libsqlite3
- CoreTelephony
- Foundation
- CoreGraphics
- CoreSpotlight
Tip
Click "+" button of section Linked Frameworks and Libraries
on general tab of your target to add the libraries.
Note
If your app is a swift project, please make sure you add -ObjC
into your app target's Other Linker Flags
under Build Settings
.
Dynamic Framework¶
- Download and extract [pointzi-framework-1.7.0.zip] (https://repo.pointzi.com/sdk/pointzi/ios/1.7.0/1.7.0/pointzi-framework-1.7.0.zip).
- Drag & drop
StreetHawkCore_Pointzi.framework
into your app project. - Go to the target general tab.
- Add the Contextual framework to the
Embedded Binaries
- Download the resources corresponding to the resource bundle
Pointzi.bundle
to the same path as the framework. - Add this resource using
Copy Bundle Resources
option underBuild Phases
of your app target. - Now you should be able to call Contextual api by importing headers like
1 |
|
Static Library¶
- Download and extract [pointzi-1.7.0.zip] (https://repo.pointzi.com/sdk/pointzi/ios/1.7.0/1.7.0/pointzi-1.7.0.zip).
- Drag & drop the
Pointzi
folder into your app project. - Ensure you added
libPointzi.a
in the folder into your app targetLink Binary With Libraries
under tabBuild Phases
. - Download the resource corresponding to the resource bundle
Pointzi.bundle
to the same path of framework (or just add resources from folder assets intoBuild Phases
). - Add this resource using
Copy Bundle Resources
option underBuild Phases
of your app target. - Now you should be able to call Contextual api by importing headers like.
1 |
|