PerimeterX is the leading provider of application security solutions that keep your business safe in the digital world. Delivered as a service, the company’s Bot Defender, Code Defender and Page Defender solutions detect risks to your web applications and proactively manage them, freeing you to focus on growth and innovation. The world’s largest and most reputable websites and mobile applications count on PerimeterX to safeguard their consumers’ digital experience. PerimeterX is headquartered in San Mateo, California and at www.perimeterx.com.
The PerimeterX iOS SDK works by constantly profiling and evaluating device behavior to ensure that the connections to your mobile APIs and services are genuine. This process is complex and detailed yet only requires initialization to manage a set of secure HTTP headers which are added to all HTTP and HTTPS requests made by the mobile application to the origin server. These HTTP headers are refreshed on a regular basis by the SDK as it is profiling the end-user’s mobile device. The PerimeterX iOS SDK works well with popular HTTP request libraries for iOS including Alamofire.
Operating System | iOS 11 and higher |
Xcode | Xcode 13 and higher |
Languages | Swift 5.5 and higher, Objective-C |
Adding PerimeterX SDK to your project with:
Add the package from the following repository:
https://github.com/PerimeterX/px-iOS-Framework
Add the PerimeterX pod to your Podfile:
platform :ios, '13.0'
use_frameworks!
target '<Your App Name>' do
pod 'PerimeterX', '<Version>'
end
Download PerimeterX_SDK.xcframework from https://github.com/PerimeterX/px-iOS-Framework
In Xcode, add the framework to the "Frameworks and Libraries" section in your target.
In your AppDelegate
:
Import the SDK.
Swift:
import PerimeterX_SDK
Objective-C:
@import PerimeterX_SDK;
Make the AppDelegate
class to conform to the PerimeterXDelegate
.
Swift:
class AppDelegate: UIResponder, UIApplicationDelegate, PerimeterXDelegate
Objective-C:
@interface AppDelegate : UIResponder <UIApplicationDelegate, PerimeterXDelegate>
Verify the SDK's version.
Swift:
print("SDK version: \(PerimeterX.sdkVersion())")
Objective-C:
NSLog(@"SDK version: %@", [PerimeterX sdkVersion]);
Call the PerimeterX/start(appId:delegate:enableDoctorCheck:completion:)
function with your AppID.
Swift:
PerimeterX.start(appId: "<APP_ID>", delegate: self, enableDoctorCheck: false) { success, error in
if success {
if let vid = PerimeterX.vid(forAppId: nil) {
print("vid: \(vid)")
}
}
else {
if let error = error {
print("error: \(error)")
}
// make sure to start the sdk again when it fails (network issue, etc.)
}
}
Objective-C:
[PerimeterX startWithAppId:@"<APP_ID>" delegate:self enableDoctorCheck:NO completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSString *vid = [PerimeterX vidForAppId:nil];
NSLog(@"vid: %@", vid);
}
else {
NSLog(@"error: %@", error);
// make sure to start the sdk again when it fails (network issue, etc.)
}
}];
That's it! 🎉
The full documentation can be found here.
link |
Stars: 10 |
Last commit: 2 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics