투케이2K

71. (Objective-C/objc) UIDevice identifierForVendor 사용해 디바이스 고유 값 (unique uuid) 확인 실시 본문

Objective-C

71. (Objective-C/objc) UIDevice identifierForVendor 사용해 디바이스 고유 값 (unique uuid) 확인 실시

투케이2K 2022. 9. 21. 12:39
반응형

[개발 환경 설정]

개발 툴 : XCODE

개발 언어 : OBJECTIVE-C

 

[소스 코드]

// MARK: - [헤더 파일에 정의 없이 : void 메소드 구현]
- (void)testMain {
    printf("\n");
    printf("==================================== \n");
    printf("[ViewController >> testMain() :: 테스트 메소드 수행] \n");
    printf("==================================== \n");
    printf("\n");
    
    
    /*
     ------------------------------------
     [요약 설명]
     ------------------------------------
     1. UIDevice 객체를 사용해서 디바이스 접근 및 기기 정보 값을 확인 할 수 있습니다
     ------------------------------------
     2. identifierForVendor 앱 공급 업체에 매핑 된 디바이스 고유값을 확인할 수 있습니다
     ------------------------------------
     3. identifierForVendor 디바이스 고유 값은 앱 공급 업체에서 제공한 모든 앱이 삭제 될 때 까지 반영구적으로 보존됩니다
     ------------------------------------
     4. identifierForVendor 디바이스 고유 값은 앱 공급 업체이서 제공한 모든 앱을 삭제 후 >> 재설치 시 >> UUID 는 변경됩니다
     ------------------------------------
     */
    
    
    // [try catch 구문 정의 실시]
    @try {
        
        // [UIDevice identifierForVendor 사용해 디바이스 고유 값 확인 실시]
        NSString *uniqueDeviceId = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
        
        
        // [로그 출력 실시]
        printf("\n");
        printf("==================================== \n");
        printf("[ViewController >> try :: 로직 처리 결과 확인] \n");
        printf("[uniqueDeviceId :: %s] \n", uniqueDeviceId.description.UTF8String);
        printf("==================================== \n");
        printf("\n");
    }
    @catch (NSException *exception) {
        printf("\n");
        printf("==================================== \n");
        printf("[ViewController >> catch :: 예외 상황 확인] \n");
        printf("[name :: %s] \n", exception.name.description.UTF8String);
        printf("[reason :: %s] \n", exception.reason.description.UTF8String);
        printf("==================================== \n");
        printf("\n");
    }
}
 

[결과 출력]


 

반응형
Comments