Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 4761 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
637 Develop [c] 다중연결 서버 만들기 #2 - select() 사용 file hooni 2013.04.23 9373
636 Develop [c] 다중연결 서버 만들기 #3 - poll() 사용 file hooni 2013.04.23 6366
635 Develop [c] 다중연결 서버 만들기 #4 - thread 사용 file hooni 2013.04.23 23742
634 Develop [c] selec()를 이용한 입출력 다중화 file hooni 2013.04.23 8269
633 Develop [c] alarm()함수 설명과 간단한 예제 file hooni 2013.04.23 6700
632 Develop [c] 네트워크 정보 알아보기 file hooni 2013.04.23 16145
631 Develop [c] 오류체크(CRC 체크 ) 소스 2 hooni 2013.04.23 8132
630 Develop [c] 오목.. 간단한 소스 ㅋㅋ file hooni 2013.04.23 9667
629 Develop [c] vc++ 에서 clrscr(), gotoxy() 함수 사용하기.. hooni 2013.04.23 14273
628 Develop [c] 최단거리 알고리즘 & 예제소스.. 13 file hooni 2013.04.23 10182
627 Develop [c] 격자 직사각형 넓이 구하기 file hooni 2013.04.23 7471
626 Develop [vc++] 게임 소스 등.. ㅋㅋ file hooni 2013.04.23 18382
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 ... 71 Next
/ 71