PointziSDK¶
You can find an example of integration here
Prerequisites¶
- Deployment target iOS 13.0 and above.
- Latest Xcode.
This setup assumes you have already setup your App Key on the Dashboard.
Step 1 - SDK Installation & Configuration¶
Add Packages¶
In Xcode, select File > Swift Packages > Add Package Dependency and enter the repository URL
Add Linker Flags¶
Go to Project -> Build Settings -> Other Linker flags and Add the following
-ObjC
Adding the Resources¶
- Download the Contextual bundle from https://repo.pointzi.com/artifactory/pointzi/ios/spm/Pointzi.bundle.zip
- Unzip and Drag and Drop Pointzi.bundle into your project
Step 2 - Initialization¶
In your Application launch function, add pointzi registration.
If you are using Swift, Add the following code in AppDelegate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
If you are ObjectiveC - React Native, Add the following code in AppDelegate, make sure the #import "StreetHawkCore_Pointzi.h" above the #if DEBUG or #ifdef FB_SONARKIT_ENABLED declaration (if present):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Step 3 - 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 Objc
1 2 3 4 5 |
|
If your view controller overrides system functions, make sure you call
super
.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 4 - 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 |
|