Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

Views 10177 Comment 0
Atachment
Attachment '2'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

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
No. Category Subject Author Date Views
1021 Develop [c] 재미있는 코딩.. file hooni 2003.04.23 23274
1020 Etc 이클립스(Eclipse) 유용한 단축키 ㅋㅋ hooni 2013.04.23 23197
1019 Etc 아두이노 관련 정보.. hooni 2013.04.23 22999
1018 PPT [ajax] 크로스 도메인(Cross Domain) 이슈 해결 방안 file hooni 2013.04.23 22957
1017 Develop 프로그래밍에서 foo, bar 함수의 유래 file hooni 2013.06.25 22883
1016 Develop [c++] 디렉토리 내의 파일 찾기 FindFirstFile() 함수 6 hooni 2013.04.23 22882
1015 Develop [c] 이진트리/트리 순회법 코드(전위/중위/후위) 5 file hooni 2015.07.02 22701
1014 Etc [link] iOS(아이폰) 개발 관련 ㅋㅋ hooni 2013.04.23 22633
1013 Develop [android] [번역] 안드로이드 Android Cloud to Device Messaging(C2DM) hooni 2013.04.23 22609
1012 System/OS [windows] 윈도우 사용자 계정 로그인 암호 분실, 암호 변경하는 방법 file hooni 2015.07.09 22540
1011 Develop [c] 포인터 학습용 예제 소스 코드 file hooni 2013.04.23 22217
1010 Etc [flash] 자동차 엔진의 원리 (4행정 사이클 그림) file hooni 2013.04.23 22160
Board Pagination Prev 1 ... 9 10 11 12 13 14 15 16 17 18 ... 99 Next
/ 99