PingTamperDetector

PingTamperDetector module for the Ping iOS SDK.

How to use

The TamperDetector class is responsible for analyzing and providing a score indicating whether the device is suspicious of being jailbroken. It uses a set of detectors, each performing a specific check.

Default Usage

To use the TamperDetector with the default set of detectors, simply create an instance of the class and call the analyze() method:

let tamperDetector = TamperDetector()
let score = tamperDetector.analyze()

if score > 0 {
    print("The device is likely jailbroken. Score: \(score)")
} else {
    print("The device is likely not jailbroken.")
}

The analyze() method returns a score between 0.0 and 1.0, where 1.0 indicates a high probability of a jailbroken device.

Built-in Detectors

The TamperDetector includes the following built-in detectors, which are available through the TamperDetector.defaultDetectors static property:

Custom Detectors

You can also create your own custom detectors. To do this, you need to create a class that conforms to the TamperDetectorProtocol and implement the analyze() method.

Here is an example of a custom detector:

import Foundation

class MyCustomDetector: TamperDetectorProtocol {
    func analyze() -> Double {
        // Implement your custom jailbreak detection logic here
        // Return a score between 0.0 and 1.0
        return 0.0
    }
}

Combining Default and Custom Detectors

You can easily combine the default detectors with your own custom detectors.

Adding Custom Detectors to the Default Set

If you want to use the default detectors and add your own, you can use the init(customDetectors:) initializer:

let customDetector = MyCustomDetector()
let tamperDetector = TamperDetector(customDetectors: [customDetector])
let score = tamperDetector.analyze()

Creating a Custom Set of Detectors

If you want to use a specific set of detectors, you can create your own array of detectors and pass it to the init(detectors:) initializer. You can use the TamperDetector.defaultDetectors static property to get the array of default detectors and modify it as you wish.

let customDetector = MyCustomDetector()
var detectors = TamperDetector.defaultDetectors
detectors.append(customDetector)

let tamperDetector = TamperDetector(detectors: detectors)
let score = tamperDetector.analyze()

© Copyright 2025-2026 Ping Identity Corporation. All Rights Reserved