Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 4679 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
873 Develop [c] 달팽이 배열? 인지 먼지.. ㅋㅋ hooni 2013.04.23 7131
872 System/OS 무선 인증 서버.. 김도.. ㅋㅋ file hooni 2013.04.23 17598
871 Develop [c] 패킷 유량/프로토콜 통계 모니터링.. file hooni 2013.04.23 8378
870 System/OS [linux] X환경 GNOME에서 KDE로 바꾸는 법.. hooni 2013.04.23 12368
869 Develop [c] 간단한 소켓 프로그래밍 샘플 file hooni 2013.04.23 8165
868 Develop [c] 도메인 소켓(Unix Domain Socket) UDP file hooni 2013.04.23 9285
867 Develop [c] 다중연결 서버 만들기 #1 - fork() 사용 file hooni 2013.04.23 12924
866 Develop [c] 다중연결 서버 만들기 #2 - select() 사용 file hooni 2013.04.23 9364
865 Develop [c] 다중연결 서버 만들기 #3 - poll() 사용 file hooni 2013.04.23 6343
864 Develop [c] 다중연결 서버 만들기 #4 - thread 사용 file hooni 2013.04.23 23705
863 Develop [c] selec()를 이용한 입출력 다중화 file hooni 2013.04.23 8260
862 Develop [c] alarm()함수 설명과 간단한 예제 file hooni 2013.04.23 6681
Board Pagination Prev 1 ... 21 22 23 24 25 26 27 28 29 30 ... 98 Next
/ 98