This document will help users install Sensfrx iOS SDK for native iOS applications. By integrating our iOS SDK, iOS apps will be shielded from fraud and misuse by attackers. Users can integrate the iOS SDK with iOS apps developed with Swift and Objective-C. After iOS SDK installation, users can track their first user event, and quickly see user profiles and user events within the Sensfrx dashboard. Verifying new or returning users and spotting high-risk activity, like using mobile emulators, home botnets, location spoofing with GPS tampering, bots, non-human queries, phony accounts, install fraud, and hijacked devices, are all possible with Sensfrx SDK integration. We distribute our iOS SDK via CocoaPods and Swift Package Manager.  


Prerequisites 

  1. Xcode 12.0+  

  2. iOS 11.0+. 

  3. Sensfrx portal account credentials  

  4. Know where to initialize and start the SDK within the application launch flow. 


There are two ways to install the Sensfrx iOS SDK. These are: 


1. Using CocoaPods : 

# Add this line to your Podfile 
pod 'SensFRX', '~> 1.0.0' 

Then run pod install in your project directory. 

2. Manual Integration: 

  1. Download the SDK package from Sensfrx website or GitHub. 

  2. Drag and drop the SDK files into your Xcode project. 

 

Configuration 


To configure the SDK, add the following code to your AppDelegate: 

 import SensFRX 

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 
   SensFRX.configure(apiKey: "YOUR_API_KEY") 
   return true 
} 


Usage 


Request Token:  

To fetch the request token for login, use the following method: 

SensFRX.getLoginRequestToken(latitude, longitude: longitude) 

If user location access is not available, please provide latitude and longitude values as 0.0 to indicate the default location. 

 

Event Monitoring

 

1. Application Event 

To track application events, add the following line to AppDelegate: 

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 
   SensFRX.trackAppEvent("open"); 
       return true 
   } 

func applicationDidBecomeActive(_ application: UIApplication) { 
   SensFRX.trackAppEvent("active"); 
   } 

func applicationWillResignActive(_ application: UIApplication) { 
   SensFRX.trackAppEvent("inactive"); 
   } 

func applicationDidEnterBackground(_ application: UIApplication) { 
   SensFRX.trackAppEvent("background"); 
   } 

func applicationWillEnterForeground(_ application: UIApplication) { 
   SensFRX.trackAppEvent("foreground"); 
   } 

func applicationWillTerminate(_ application: UIApplication) { 
   SensFRX.trackAppEvent("terminate"); 
   } 

 

2. Screen Change Event 

Sensfrx manage screen change event itself. If the app event is not getting generated then use the below method. 

SensFRX.trackScreenEvent("screen name"); 


3. Click Event 

To track click events, use the following method: 

SensFRX.trackClickEvent(screenName:"Home", screenOrientation:UIApplication.shared.statusBarOrientation, view: self.view, touch:touch); 

Example:  

override func viewDidLoad() { 
 super.viewDidLoad() 

 let touch = UITouch(); 
SensFRX.trackClickEvent("Home",screenOrientation:UIApplication.shared.statusBarOrientation, view: self.view, touch:touch); 
} 


Sample Projects 

For sample projects demonstrating the SDK integration, visit the Sensfrx GitHub repository. 



Support and Resources 

For any support or assistance, please reach out to our support team at info@sensfrx.com. You can also find additional resources and tutorials on our developer portal. 

On this page