Skip to content

Add Simple GUI for iOS Security Intrusion

The DoveRunner Mobile App Security library within your App is automatically activated when right after App has launched. If DoveRunner Mobile App Security library has detected any abnormal environment (such as jailbroken-device, executable has decrypted or debugger has attached) it will close the app after 20 seconds irrespectively of user action, so the app should notify the detection result to user and show some proper message box for user can recognize there’s some invalid environment in his/her device.

If you want to show that dialog box in your app, you can easily do that inserting small chunk of code into “AppDelegate.m” file.

First, open MyRnApp xcode project and select “AppDelegate.m” file.

Click again selected “AppDelegate.m” item and rename it “AppDelegate.mm”. After renaming move source code to ‘didFinishLaunchingWithOptions’ method part and paste following small code block between last two lines.

Simple UI code into ‘AppDelegate.mm’ for React Native project

Section titled “Simple UI code into ‘AppDelegate.mm’ for React Native project”
NSString* msg = @"\n-------------------------------------\n* Security Threat : ";
int tamper = ObjC_IsAbnormalEnvironmentDetected();
if ( tamper > 0 )
{
NSString* msg = @"Abnormal Environment Detected !!";
if (( tamper & DETECTED_JAILBROKEN ) > 0 )
msg = [msg stringByAppendingString:@"\n - Jailbroken"];
if (( tamper & DETECTED_DRM_DECRYPTED ) > 0 )
msg = [msg stringByAppendingString:@"\n - Executable is not encrypted"];
if (( tamper & DETECTED_DEBUG_ATTACHED ) > 0 )
msg = [msg stringByAppendingString:@"\n - App is debugged"];
if (( tamper & ( DETECTED_HASH_INFO_CORRUPTED | DETECTED_HASH_MODIFIED )) > 0 )
msg = [msg stringByAppendingString:@"\n - App integrity corrupted"];
if (( tamper & ( DETECTED_CODESIGN_CORRUPTED | DETECTED_EXECUTABLE_CORRUPTED )) > 0 )
msg = [msg stringByAppendingString:@"\n - App executable has corrupted"];
if (( tamper & DETECTED_CERTIFICATE_CHANGED ) > 0 )
msg = [msg stringByAppendingString:@"\n - App has re-signed"];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"DoveRunner Mobile App Security"
message:msg
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Confirm"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) { exit(0); }];
[alert addAction:confirm];
[rootViewController presentViewController:alert animated:YES completion:nil];
}

Previous sample UI code included in “AppsealingiOS.mm” source file of DoveRunner Mobile App Security SDK so you can copy & paste the code block. Check whether the code block has inserted in right place.