Skip to content

Acquire Device Unique Identifier

DoveRunner Mobile App Security SDK generates and manages unique identifier for each device. Customer who use the DoveRunner Mobile App Security SDK can use the interface of DoveRunner Mobile App Security to verify the device unique identifier, if necessary. And can be used for the business using the hacking data service provided by DoveRunner Mobile App Security.

First, open your Xcode project and open “ViewController.swift” file. After you opened the swift file put following code into that (If ViewController.swift file has already included ‘viewDidAppear’ method just insert the body of following code below ‘super.viewDidAppear( animated );’ line.)

Simple UI code into ‘ViewController.swift’ for Swift project

override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear( animated );
let inst: AppSealingInterface = AppSealingInterface();
let appSealingDeviceID = String.init( cString: inst._GetAppSealingDeviceID() );
let alertController = UIAlertController( title: "DoveRunner Mobile App Security DeviceID",
message: appSealingDeviceID, preferredStyle: .alert );
alertController.addAction( UIAlertAction( title: "Confirm", style: .default ));
self.present( alertController, animated: true, completion: nil );
}

Sample code is also included in “AppSealingiOS.mm” file so you can copy & paste in that file.

If your project is Objective-C based then you can use following code to show simple UI.

Simple UI code into ‘ViewController.mm’ for Objective-C project

#include "AppsealingiOS.h"
char _appSealingDeviceID[64];
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if ( ObjC_GetAppSealingDeviceID( _appSealingDeviceID ) == 0 )
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"DoveRunner Mobile App Security DeviceID"
message:[[NSString alloc] initWithUTF8String:_appSealingDeviceID]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Confirm"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) { }];
[alert addAction:confirm];
[self presentViewController:alert animated:YES completion:nil];
}
}

Your app will show simple alert box like below when you run your app.