Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 10197 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
529 Develop [asp] 문자열 관련 함수 요약 hooni 2013.04.23 9157
528 Develop [c#] 본현이형 논문 자료 (HIDS)ㅋㅋ file hooni 2013.04.23 9155
527 Develop [php] 그래프 그리는 프로그램.. file hooni 2013.04.23 9154
526 Develop [c] i2osp 임시로.. ㅋㅋ file hooni 2003.04.23 9125
525 Develop [c++] 현승이가 준 메신저 소스.. ㅋㅋ file hooni 2013.04.23 9123
524 Develop [c] 이진트리(binary tree) 샘플소스 (삽입, 삭제, 운행) file hooni 2003.04.23 9111
523 Develop [java] 마우스 버튼 테스트.. swing.. file hooni 2013.04.23 9109
522 Develop [c] 소수 구하기 #1 (한정된 숫자 내에 있는 소수 걸러내기) hooni 2003.04.23 9103
521 Develop [c++] 트리컨트롤 스텝 3 예제.. file hooni 2013.04.23 9101
520 Develop [js] 부모창에서 자식창으로 문자열 전달.. file hooni 2013.04.23 9096
519 Develop [jsp] 유효성체크(Client, Server 에서) file hooni 2003.04.23 9095
518 Develop [c] 학생명단 관리 프로그램 소스 ㅋㅋ 1 file hooni 2003.04.23 9083
Board Pagination Prev 1 ... 50 51 52 53 54 55 56 57 58 59 ... 99 Next
/ 99