Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 4761 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
205 Develop [c] scanf(), printf() 포맷의 형변환 hooni 2003.04.23 10875
204 Develop [c] RSA 암호화 구현(gmp 라이브러리 활용) file hooni 2016.10.03 1000
203 Develop [c] pcap을 이용한 패킷 분석 ㅎㅎ hooni 2003.04.23 10235
202 Develop [c] pcapdump 파일 분석 하는 프로그램.. ㅋㅋ file hooni 2013.04.23 6909
201 Develop [c] openssl 샘플코드.. 어려움 ㅠㅠ file hooni 2013.04.23 7034
200 Develop [c] OpenGL 직사각형(2D) 크기 확대/축소 hooni 2003.04.23 9086
199 Develop [c] OpenGL 임시로 여기 올림.. hooni 2003.04.23 10338
198 Develop [c] OpenGL 시어핀스키 가스킷(p.73 - 첫시간) hooni 2003.04.23 8770
197 Develop [c] OpenGL 색 입방체의 회전(입체) hooni 2003.04.23 7890
196 Develop [c] OpenGL 마우스 이벤트 hooni 2003.04.23 8750
195 Develop [c] OpenGL 관측점 이동 hooni 2003.04.23 7634
194 Develop [c] Mac OS 에 gmp(gmp.h) 라이브러리 설치 hooni 2016.10.03 1427
Board Pagination Prev 1 ... 49 50 51 52 53 54 55 56 57 58 ... 71 Next
/ 71