Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 4778 추천 수 0 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
437 Develop [js] 이벤트 핸들러(Event Handlers) hooni 2003.04.23 6750
436 Develop [js] 인터넷 주소(URL) 인코딩 ㅋㅋ hooni 2013.04.23 11376
435 Develop [js] 자바스크립트 escape()를 PHP로 받기 hooni 2013.04.23 6001
434 Develop [js] 자바스크립트 메뉴얼 사이트.. ㅋㅋ hooni 2013.04.23 7428
433 Develop [js] 자바스크립트 이벤트 핸들.. hooni 2003.04.23 7942
432 Develop [js] 자바스크립트(Javascript) 코드를 동적으로 삽입하는 방법.. file hooni 2013.04.23 22931
431 Develop [js] 자바스크립트로 만든 게임 file hooni 2013.04.23 8404
430 Develop [js] 자바스크립트로 응용프로그램 실행 ㅎㅎ hooni 2003.04.23 9849
429 Develop [js] 자바스크립트를 동적으로 로딩하기 hooni 2013.04.23 13603
428 Develop [js] 자바스크립트와 정규표현식 메뉴얼 (chm 형식) file hooni 2013.04.23 7638
427 Develop [js] 자바스크립트의 클로저 (JavaScript's Closure) hooni 2013.05.15 13014
426 Develop [js] 점점 커지는 새창.. hooni 2003.04.23 7020
425 Develop [js] 좋은 강연자료 & UI 자료 hooni 2014.10.06 984
424 Develop [js] 주민번호 생성기.. file hooni 2003.04.23 8168
423 Develop [js] 주소표시줄 URL 읽어오기 (변경까지) secret hooni 2014.01.21 1
422 Develop [js] 초간단 암호화/복호화 소스.. hooni 2003.04.23 8871
Board Pagination Prev 1 ... 45 46 47 48 49 ... 74 Next
/ 74