Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 4760 댓글 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 [js] 간단한 게임 프로토타입 (HTML5 와는 무관) hooni 2013.04.23 15172
636 Develop [js] 가운데 새창 뜨는 함수와 이벤트 hooni 2003.04.23 6739
635 Develop [js] window.open() 속성 사용 방법 hooni 2013.11.18 13628
634 Develop [js] URL 파싱하기 (jQuery 안쓰고) hooni 2017.12.14 1429
633 Develop [js] Text 중 URL 형식을 인식해 단축 URL로 변경 file hooni 2013.04.23 8719
632 Develop [js] Text 값을 클립보드에 복사하기 hooni 2020.10.10 776
631 Develop [js] show/hide 이벤트 감시 (Observing show/hide event) hooni 2021.02.03 2736
630 Develop [js] selectbox 선택 후 input 박스에 적용 hooni 2013.04.23 8340
629 Develop [js] php의 number_format() 함수와 같은.. ㅋㅋ hooni 2013.04.23 6941
628 Develop [js] One Time Pad key generatorㅡ.,ㅡ; file hooni 2013.04.23 6803
627 Develop [js] JSON 컨트롤.. 재귀호출로 값 출력하기 hooni 2013.04.23 28666
626 Develop [js] jQuery, Javascript 모바일(스마트폰) 판단하는 방법 hooni 2015.04.26 2550
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 ... 71 Next
/ 71