Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

Views 4787 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
349 Develop [c] 파이프(popen)로 다른 프로세스 실행결과 가져오기 file hooni 2013.04.23 8427
348 Develop [c] 텍스트 파일(로그)을 정해진 라인 단위로 쪼개주는 코드 file hooni 2013.04.23 7067
347 Develop [c] 테트리스3D (Tetris 3D) file hooni 2013.04.23 7116
346 Develop [c] 테트리스(Tetris) 게임(도스용) 소스코드 file hooni 2003.04.23 11523
345 Develop [c] 퀵정렬(quick sort) 예제 소스.. file hooni 2013.04.23 7992
344 Develop [c] 콘솔에서 패스워드 입력시 문자 보이지 않게 하는 코드 file hooni 2013.04.23 8359
343 Develop [c] 코드 최적화에 대해.. hooni 2013.04.23 7715
342 Develop [c] 컴파일러 선행처리기 따라하기.. file hooni 2003.04.23 6703
341 Develop [c] 컴파일러 DFA구현^^ 입력 받아 실행 4 file hooni 2003.04.23 8142
340 Develop [c] 캘린더 양음 변환 함수 hooni 2003.04.23 8787
339 Develop [c] 최대공약수, 최소공배수, 서로소 구하기 (펌) hooni 2013.04.23 11207
338 Develop [c] 최대공약수 알고리즘 (유클릿) hooni 2003.04.23 8909
Board Pagination Prev 1 ... 37 38 39 40 41 42 43 44 45 46 ... 71 Next
/ 71