How to use SDK Input Threat Events for iOS XCFrameworks
Overview
In this article, we will guide you through the process of using SDK Input Threat Events to protect your mobile SDKs in iOS XCFrameworks. By integrating these threat events into your SDK, you can detect and respond to various security threats, ensuring that the applications using your SDK are secure.
Prerequisites
Before you begin, ensure that you have the following:
- An iOS SDK project set up in Xcode.
- The SDK XCFramework is integrated into your project.
- An iOS xcframework.zip file
- Basic knowledge of Objective-C or Swift programming.
Step-by-Step Guide
1. Integrate the SDK XCFramework
Ensure that your SDK XCFramework is properly set up.
2. Modify the SDK’s Info.plist File
The Info.plist
File in your SDK needs to be configured to specify the threat events your SDK will handle and the receiver class that will process these events.
- Open project
- Click on the info tab
- Click the + symbol
- Add classes
Add the following keys and values to your SDK’s Info.plist
File:
ThreatEventNames
: A comma-separated list of threat events that the SDK will monitor.
ThreatEventReceiver
: The class within your SDK that will handle these threat events.
3. Implement the Threat Event Receiver in Your SDK
Create or modify the class within your SDK that will handle the threat events. This class should conform to the expected interface provided by your SDK. Here’s an example implementation in Objective-C:
The following code provides the implementation for the <Appdome_ADThreatManager_Example>
Class, which will handle threat events. This class should be part of your SDK.
Note: Replace all class name instances labed <Appdome_ADThreatManager_Example>
with the specific name of your class listener name. This is crucial to ensure your code functions correctly with the intended event data.
ADThreatManager.h
#import <Foundation/Foundation.h>
@interface <Appdome_ADThreatManager_Example> : NSObject - (void)onNotification:(NSNotification *)notification; @end
ADThreatManager.m
@implementation <Appdome_ADThreatManager_Example>
- (void)onNotification:(NSNotification *)notification {
NSLog(@"<Appdome_ADThreatManager_Example>::notification received: %@", notification);
}
@end
In this implementation:
<Appdome_ADThreatManager_Example>
is a class that inherits fromNSObject
.- It has a method
onNotification:
which logs received notifications.
Meta-Data for Mobile SDK Threat-Events
Below is the list of metadata that can be associated with each mobile SDK built with an XCFramework.
Context Key | Reason |
reasonCode |
Reason code of the occurred event |
fusedAppToken |
The task ID of the Appdome fusion of the currently running SDK. |
kernelInfo |
Info about the kernel: system name, node name, release, version, and machine. |
reasonData |
Reason for the attack. For example, root detection. |
defaultMessage |
A pre-defined message that will be displayed to the SDK or logged when a specific event occurs. |
message |
A message will be displayed to the SDK when an event occurs. |
timestamp |
The exact date and time when the event occurred are recorded in a standard timestamp format. |
By following these steps, you can effectively integrate and use SDK Input Threat Events to protect your mobile SDKs in iOS XCFrameworks. This setup will help your SDK detect and respond to security threats, enhancing the overall security of applications that integrate your SDK.
Related Articles:
- How to Obfuscate SDK Logic using Appdome SDKProtect™
- How to Use Appdome SDKProtect to Secure Mobile SDKs
- Automated SDK Protection – Appdome SDKProtect™
How Do I Learn More?
If you have any questions, please send them our way at support.appdome.com or via the chat window on the Appdome platform.
Thank you!
Thanks for visiting Appdome! Our mission is to secure every app on the planet by making mobile app security easy. We hope we’re living up to the mission with your project.