Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

Views 10175 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
351 Develop [c] 내가 만든 암호화 프로그램.. 좋아^^ file hooni 2013.04.23 8491
350 Develop [c] 패킷정보출력(경로, 패킷길이, 3hand, sync, ack..) file hooni 2003.04.23 8485
349 Develop [c] 간단한 순위 루틴.. (정보처리기사) hooni 2003.04.23 8480
348 Develop [c] 함수 목록과 예제 소스 파일 file hooni 2013.04.23 8478
347 Develop [c]디렉토리 탐색 file hooni 2003.04.23 8472
346 Develop [c] 시스템 보안 과제.. 시간(amc time) 변경 file hooni 2013.04.23 8468
345 Develop [php] 현재에서 일정한 날짜 더하기.. hooni 2013.04.23 8451
344 Develop [c] 파일 복사(copy) 프로그램 샘플 소스 file hooni 2003.04.23 8450
343 Develop [c] 문자열 뒤집기 초간단 샘플 코드 ㅎㅎ hooni 2013.04.23 8446
342 Develop [js] 비만 지수 측정(BMI) ㅎㅎ file hooni 2013.04.23 8442
341 Develop [c] 파일(File) 관련 함수 샘플 코드 file hooni 2003.04.23 8440
340 Develop [c++] MFC 모든 헤더와 라이브러리 설명 | [교류]Programming hooni 2013.04.23 8429
Board Pagination Prev 1 ... 37 38 39 40 41 42 43 44 45 46 ... 71 Next
/ 71