Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

Views 4659 Votes 0 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
357 Develop [html] HTML5 튜토리얼 링크 ㅋㅋ hooni 2013.04.23 12813
356 System/OS [linux] 콘솔 기본언어 설정 방법 hooni 2013.04.23 12826
355 System/OS [sql] 내 방명록 답글 찾는 쿼리문.. (JOIN 구문) hooni 2003.04.23 12845
354 System/OS [linux] ProFTPD 타임아웃 설정 hooni 2003.04.23 12851
353 Develop [doc] UI개발시 유용한 소프트웨어 (개발 및 디버깅 툴) hooni 2013.04.23 12909
352 Develop [c] 다중연결 서버 만들기 #1 - fork() 사용 file hooni 2013.04.23 12917
351 System/OS [router] 시스코 라우터 명령어 모드.. hooni 2013.04.23 12944
350 System/OS [linux] 아파치 설치/설정(proxy) hooni 2003.04.23 12965
349 Develop [js] 자바스크립트의 클로저 (JavaScript's Closure) hooni 2013.05.15 12977
348 Develop [php] 심플한 게시판 ㅋㅋ 1 file hooni 2013.04.23 12985
347 Develop [js] AngularJS를 소개합니다. file hooni 2014.01.06 13014
346 System/OS [linux] ipfwadm를 이용한 패킷필터링(구버전) hooni 2003.04.23 13015
345 System/OS [linux] Proftpd 설치 가이드 hooni 2003.04.23 13021
344 System/OS [linux] DHCP(Dynamic Host Configuration Protocol) 서버 hooni 2003.04.23 13023
343 Develop [html] 캐쉬된 웹페이지 사용하지 않도록 하는 방법 hooni 2003.04.23 13028
342 System/OS [linux] 한글 URL 인식할 수 있게 아파치(Apache) 설정 (mod_url.c 설치) hooni 2013.04.23 13058
Board Pagination Prev 1 ... 50 51 52 53 54 ... 74 Next
/ 74