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
번호 분류 제목 글쓴이 날짜 조회 수
781 Develop [c] 가위 바위 보 서버, 클라이언트 소스코드 file hooni 2003.04.23 8163
780 Develop [c] fork() 시스템 콜 사용 방법. hooni 2003.04.23 27575
779 Develop [c] 소켓 프로그래밍 요약.. hooni 2003.04.23 6956
778 Develop [c] 소켓주소 구조체에 대해.. hooni 2003.04.23 6716
777 Develop [c] 소켓의 세가지 동작모드 hooni 2003.04.23 6896
776 Develop [c] 컴파일러 DFA구현^^ 입력 받아 실행 4 file hooni 2003.04.23 8097
775 Develop [c] OpenGL 시어핀스키 가스킷(p.73 - 첫시간) hooni 2003.04.23 8740
774 Develop [c] 시어핀스키 가스킷..(p.582, A.2 - 두번째) hooni 2003.04.23 7466
773 Develop [c] 약수/최대공약수/완전수 알고리즘 hooni 2003.04.23 8855
772 Develop [c] 프로그래밍의 전반적인 설명 ppt file hooni 2003.04.23 7661
771 Develop [jsp] HelloServlet 출력문 file hooni 2003.04.23 7782
770 Develop [jsp] Get방식, Post방식 전송 예제.. file hooni 2003.04.23 13749
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71