Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 4691 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
793 Develop [jsp][php] 간단한 강좌 자료.. file hooni 2003.04.23 8117
792 Develop [c] 학생명단 관리 프로그램 소스 ㅋㅋ 1 file hooni 2003.04.23 7778
791 Develop [c] 근의 공식으로 2차방정식 풀기.. file hooni 2003.04.23 7780
790 Develop [c] 이진트리(binary tree)의 운행.. hooni 2003.04.23 8273
789 Develop [c] 이진트리(binary tree)의 특성 file hooni 2003.04.23 9613
788 Develop [자료구조] 트리(tree) 용어정리 file hooni 2003.04.23 11075
787 Develop [c] 농구팀 점수 산출 프로그램 소스 file hooni 2003.04.23 7388
786 Develop [c] 단어 입력/수정 프로그램 소스 file hooni 2003.04.23 7031
785 Develop [c] 정사각배열의 서브 배열의 최대 값 구하기 file hooni 2003.04.23 7026
784 Develop [c] 이진트리(binary tree) 샘플소스 (삽입, 삭제, 운행) file hooni 2003.04.23 7812
783 Develop [java] 컴포넌트 배치 ㅡ.,ㅡ; hooni 2003.04.23 7158
782 Develop [html] 메타태그 사용예.. 은지나 바라~ hooni 2003.04.23 7236
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71