Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 4645 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

UUID 쉽게 사용하기 ㅋㅋ


KeychainItemWrapper.h/m 파일은 업로드된 것을 사용해도 되고 아래 URL에 있는 내용을 사용해도 됨.

(어차피 업로드 된 것도 저거 다운 받아서 업로드 한거니.. ㅋㅋ)


# KeychainItemWrapper.h 파일

https://developer.apple.com/library/ios/samplecode/GenericKeychain/Listings/Classes_KeychainItemWrapper_h.html


# KeychainItemWrapper.m 파일

https://developer.apple.com/library/ios/samplecode/GenericKeychain/Listings/Classes_KeychainItemWrapper_m.html


#import "KeychainItemWrapper.h"

- (NSString *)getDeviceUUID {
    KeychainItemWrapper *keychainItemWrapper =
    [[KeychainItemWrapper alloc] initWithIdentifier:@"UUID-Identifier" accessGroup:nil];
    NSString *uuidString = [keychainItemWrapper objectForKey:(__bridge id)(kSecAttrAccount)];
    
    if (uuidString == nil || [uuidString length] == 0) {
        // if there is not UUID in keychain, make UUID and save it.
        CFUUIDRef uuidRef = CFUUIDCreate(NULL);
        CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
        CFRelease(uuidRef);
        uuidString = [NSString stringWithString:(__bridge NSString *)uuidStringRef];
        CFRelease(uuidStringRef);
        
        // save UUID in keychain
        [keychainItemWrapper setObject:uuidString forKey:(__bridge id)(kSecAttrAccount)];
    }
    
    return uuidString;
}



?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
1089 System/OS 네트워크 용어 정리 file hooni 2022.11.20 1142
1088 PPT 네오웹 세미나 자료~ secret hooni 2013.05.28 0
1087 System/OS 나중에 해봐야지.. libconv 설치.. ㅡ,.ㅡ; hooni 2013.04.23 19280
1086 Develop 객체지향 프로그래밍에 대한 개념.. (객체) file hooni 2013.04.23 7308
1085 System/OS 개인적으로 쓰고 있는 zshrc 파일 hooni 2022.02.25 811
1084 System/OS 개인적으로 쓰고 있는 bash_profile hooni 2015.01.16 838
1083 Etc 개발자가 알아야할 10가지 보안팁으로 코드 보호하기 hooni 2013.04.23 16401
1082 System/OS [펌] 마이크로서비스, 모노리포, SRE, ... 덮어놓고 구글 따라하면 안 되는 기술들 file hooni 2020.10.15 934
1081 Develop [펌] 게임 엔진 만든거 공개합니다. hooni 2015.02.21 2342
1080 Develop [자료구조] 트리(tree) 용어정리 file hooni 2003.04.23 11049
1079 Etc [용어] POC, Pilot, BMT에 대한 IT 업계에서 통용되는 의미 hooni 2014.01.02 41944
1078 Etc [세미나] XML 레포트.. hooni 2003.04.23 19697
Board Pagination Prev 1 ... 3 4 5 6 7 8 9 10 11 12 ... 98 Next
/ 98