We will soon provide you with the document translated by a professional translator.

If you have any questions, please contact us.

We will make every effort to further enhance our services.

App Safer iOS SDK Guide

App Safer iOS is a mobile security solution provided by NAVER Cloud Platform, which offers APIs to detect threats against mobile devices or services. App Safer library for iOS consists of one framework with bitcode enabled/disabled.

App Safer iOS Features

  • Jailbreak Detection
  • Simulator Detection
  • Debugging Detection
  • Memory Tampered Detection
  • Unauthorized Signature Detection

App Safer iOS supported environment

File name OS Version
AppSaferFramework.framework iOS 8.0 or later

How to apply App Safer iOS SDK

How to apply AppSaferFramework is as follows.
It is recommended that you build it in Xcode 8.0 or later.

  1. Place AppSaferFramework.framework in the root of the project.

  2. In the project settings, go to General > Frameworks, Libraries, and Embedded Content and add all frameworks.

    • AppSaferFramework.framework and frameworks(Nelo2SDK, CrashReporter) within subfolder.
    • For Bitcode Enabled version, set Build Settings > Enable Bitcode to Yes.
    • For Bitcode Disabled version, set Build Settings > Enable Bitcode to No.
  3. (Optional) Set Build Settings > Framework Search Paths to the path where AppSaferFramework.framework file is located.

List of App Safer iOS APIs

Class name API name API description
AppSafer - (int)
initAppSafer:(id)delegate
serviceCode:(NSString *)serviceCode
key:(NSString *)appsaferKey
Initializes AppSafer to use it.
- (int)checkTampering Perform real-time security detection
  • Jailbreak detection
  • Simulator detection
  • Debugging detection
  • Memory Tampered detection
  • Unauthorized Signature detection
- (int)setUserId:(NSString *)userId Sets a user ID.
Delegate name Required API name API description
AppSaferDelegate Required - (void)appSaferDidInitFinish:(NSUInteger)result msg:(NSString *)message Receives the result of App Safer initialization.
Required - (void)appSaferDidCheckTamperingFinish:(int)result Passes the result when the checkTampering function is executed.
Optional - (void)appSaferDetectedJailbreak Called when jailbreaking is detected.
Optional - (void)appSaferDetectedSimulator Called when simulator is detected.
Optional - (void)appSaferDetectedDebugging Called when debugging is detected.
Optional - (void)appSaferDetectedMemoryTampered Called when memory tampered is detected.

Description of App Safer iOS APIs

- (int) initAppSafer:(id)delegate serviceCode:(NSString )serviceCode key:(NSString )appsaferKey

Initializes App Safer to use it. It initializes the information and global variables required to send logs.

  • All of App Safer APIs can be used after the initAppSafer() has been successfully called.
  • You must implement AppSaferDelegate to receive whether the initialization is successful.
Parameter
Parameter Description
delegate Instance that implements AppSaferDelegate
serviceCode Service code for App Safer
NAVER CLOUD PLATFORM users must set this to “ncloud”
appsaferKey Appsafer key generated when registering an app to the Console
Return Value
Return value Description
SUCCESS(0) Succeeded
FAIL(-1) Failed
Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (IBAction)initAppSafer:(id)sender {
    AppSafer *appSafer = [[AppSafer alloc] init];

    int res = FAIL;
    if(appSafer != nil) {
        // APP_SAFER_KEY generated when registering an app to the Console
        res = [appSafer initAppSafer:self serviceCode:@"ncloud" key:"<APP_SAFER_KEY>"];

        NSLog(@"initAppSafer result %d", res);

        if(res == SUCCESS) {
            // init success
        } else if(res == FAIL) {
            // init fail
        }
    } else {
        NSLog(@"AppSafer is nil");
    }
}


- (int)checkTampering

Perform real-time security detection(Jailbreak detection, simulator detection, debugging detection, memory tampered detection and unauthorized detection). You should use AppSaferDelegate to receive scan results.

Return Value
Return value Description
SUCCESS(0) Scan start succeeded
FAIL(-1) Scan start failed
BLOCK(2) Blocked in violation of security policy
BEFOREINIT(3) AppSafer not initialized
Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (IBAction)checkAppSafer:(id)sender {
    AppSafer *appSafer = [[AppSafer alloc] init];

    if(appSafer != nil) {
        int res = [appSafer checkTampering];

        switch(res) {
            case FAIL:
                NSLog(@"Failed to check tampering");
                break;
            case SUCCESS:
                NSLog(@"Check Tampering Success");
                break;
            case BLOCK:
                NSLog(@"Device is blocked");
                break;
            case BEFOREINIT:
                NSLog(@"AppSafer is not initialized");
                break;
        }
    } else {
        NSLog(@"AppSafer is nil");
    }
}

@end


- (int)setUserId:(NSString *)userId

This API is used to include a user ID in logs sent to the App Safer server when initialization and detection events occur.

Parameter
Parameter Description
userID User ID
Return Value
Return value Description
SUCCESS(0) Succeeded
FAIL(-1) Failed
Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (IBAction)setUserId:(id)sender {
    AppSafer *appSafer = [[AppSafer alloc] init];

    if(appSafer != nil) {
        NSLog(@"setUserId text %@", [self.useridText text]);

        int res = [appSafer setUserId:[self.useridText text]];

        switch(res) {
            case FAIL:
                NSLog(@"Failed to set userId");
                break;
            case SUCCESS:
                NSLog(@"setUserId Success");
                break;
        }
    } else {
        NSLog(@"AppSafer is nil");
    }
}

Description of App Safer iOS Callback Function

All of App Safer's scan functions work asynchronously, and the result handling is delegated through AppSaferDelegate.
To receive the scan results, you must implement AppSaferDelegate provided by App Safer and register it using the initAppSafer() function.

- (void)appSaferDidInitFinish:(int)result

Passes the result when the initialization is completed after calling the initAppSafer() function.

Parameter
Parameter Description
SUCCESS(0) Succeeded
FAIL(-1) Failed
BLOCK(2) Blocked in violation of security policy
Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (void)appSaferDidInitFinish:(NSUInteger)result msg:(NSString *)message {
    NSLog(@"appSaferDidInitFinish result %d", result);
    if(result == BLOCK) {
        NSLog(@"Device is blocked!");
        // add to exit application logic
    }
}


- (void)appSaferDidCheckTamperingFinish:(int)result

Called to pass the scan result when the scan is completed after calling the checkTampering function.

Parameter
Return value Description
SAFE(0) Event not detected
FAIL(-1) Scan start failed
DETECT(1) Detected
BLOCK(2) Blocked in violation of security policy
Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (void)appSaferDidCheckTamperingFinish:(int)result {
    NSLog(@"appSaferDidCheckTamperingFinish result %@",
          result == FAIL   ? @"FAIL" :
          result == SAFE   ? @"SAFE" :
          result == DETECT ? @"DETECT" :
          result == BLOCK  ? @"BLOCK": @"UNKNOWN");

    if(result == BLOCK) {
        NSLog(@"Device is blocked!");
        // add to exit application logic
    }
}


- (void)appSaferDetectedJailbreak

Called when the jailbreaking is detected after calling the checkTampering() function. You can use this API when you want to get the results even if the checkTampering() function operation has not yet been completed.

Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (void)appSaferDetectedJailbreak {
    NSLog(@"[DETECT] appSaferDetectedJailbreak");
}


- (void)appSaferDetectedSimulator

Called when virtual machine environment is detected after calling the checkTampering() function. You can use this API when you want to get the results even if the checkTampering() function operation has not yet been completed.

Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (void)appSaferDetectedSimulator {
    NSLog(@"[DETECT] appSaferDetectedSimulator");
}


- (void)appSaferDetectedDebugging

Called when the debugging is detected after calling the checkTampering() function. You can use this API when you want to get the results even if the checkTampering() function operation has not yet been completed.

Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (void)appSaferDetectedDebugging {
    NSLog(@"[DETECT] appSaferDetectedDebugging");
}


- (void)appSaferDetectedMemoryTampered

Called when the memory tampered is detected after calling the checkTampering() function. You can use this API when you want to get the results even if the checkTampering() function operation has not yet been completed.

Example
#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (void)appSaferDetectedMemoryTampered {
    NSLog(@"[DETECT] appSaferDetectedMemoryTampered");
}

App Safer iOS Use Case

Initialize

#import <AppSaferFramework/AppSaferFramework.h>

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    AppSafer *appSafer = [[AppSafer alloc] init];

    int res = FAIL;
    if(appSafer != nil) {
        // APP_SAFER_KEY generated when registering an app to the Console
        res = [appSafer initAppSafer:self serviceCode:@"ncloud" key:"<APP_SAFER_KEY>"];

        NSLog(@"initAppSafer result %d", res);

        if(res == SUCCESS) {
            // init success
        } else if(res == FAIL) {
            // init fail
        }
    } else {
        NSLog(@"AppSafer is nil");
    }
}

- (void)appSaferDidInitFinish:(NSUInteger)result msg:(NSString *)message {
    NSLog(@"appSaferDidInitFinish result %d", result);
    if(result == BLOCK) {
        NSLog(@"Device is blocked!");
        // add to exit application logic
    }
}


Check real-time Security Detection

@implementation ViewController

- (IBAction)checkAppSafer:(id)sender {
    AppSafer *appSafer = [[AppSafer alloc] init];

    if(appSafer != nil) {
        int res = [appSafer checkTampering];

        switch(res) {
            case FAIL:
                NSLog(@"Failed to check tampering");
                break;
            case SUCCESS:
                NSLog(@"Check Tampering Success");
                break;
            case BLOCK:
                NSLog(@"Device is blocked");
                break;
            case BEFOREINIT:
                NSLog(@"AppSafer is not initialized");
                break;
        }
    } else {
        NSLog(@"AppSafer is nil");
    }
}

- (void)appSaferDidCheckTamperingFinish:(int)result {
    if(result == BLOCK) {
        [self.msgbox setText:@"Device is blocked!"];
        // add to exit application
    }

    NSLog(@"appSaferDidCheckTamperingFinish result %@",
          result == FAIL   ? @"FAIL" :
          result == SAFE   ? @"SAFE" :
          result == DETECT ? @"DETECT" :
          result == BLOCK  ? @"BLOCK": @"UNKNOWN");
}

- (void)appSaferDetectedJailbreak {
    NSLog(@"[DETECT] appSaferDetectedJailbreak");
}

- (void)appSaferDetectedSimulator {
    NSLog(@"[DETECT] appSaferDetectedSimulator");
}

- (void)appSaferDetectedDebugging {
    NSLog(@"[DETECT] appSaferDetectedDebugging");
}

- (void)appSaferDetectedMemoryTampered {
    NSLog(@"[DETECT] appSaferDetectedMemoryTampered");
}

Note

This product is supported across multiple regions.

See also

You can see the related topics listed below.

に対する検索結果は~件です。 ""

    に対する検索結果がありません。 ""

    処理中...