콘텐츠로 이동

기기 식별자

AppSealing SDK는 각 기기에 대한 고유 식별자를 생성하고 관리합니다.

using System;
using ObjCRuntime;
[DllImport("__Internal")]
static extern int ObjC_GetAppSealingDeviceID(IntPtr deviceId);
public string GetDeviceId()
{
var buffer = Marshal.AllocHGlobal(64);
try
{
var result = ObjC_GetAppSealingDeviceID(buffer);
if (result == 0)
{
return Marshal.PtrToStringAnsi(buffer);
}
return null;
}
finally
{
Marshal.FreeHGlobal(buffer);
}
}
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
string deviceId = GetDeviceId();
if (!string.IsNullOrEmpty(deviceId))
{
var alert = UIAlertController.Create("AppSealing Device ID", deviceId, UIAlertControllerStyle.Alert);
alert.AddAction(UIAlertAction.Create("확인", UIAlertActionStyle.Default, null));
PresentViewController(alert, true, null);
}
}