Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

Views 4771 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
217 Develop [js] jQuery 코드 작성시 편리한 HTML 템플릿 hooni 2013.12.17 33111
216 Develop [js] jQuery, Javascript 모바일(스마트폰) 판단하는 방법 hooni 2015.04.26 2556
215 Develop [js] JSON 컨트롤.. 재귀호출로 값 출력하기 hooni 2013.04.23 28668
214 Develop [js] One Time Pad key generatorㅡ.,ㅡ; file hooni 2013.04.23 6807
213 Develop [js] php의 number_format() 함수와 같은.. ㅋㅋ hooni 2013.04.23 6944
212 Develop [js] selectbox 선택 후 input 박스에 적용 hooni 2013.04.23 8340
211 Develop [js] show/hide 이벤트 감시 (Observing show/hide event) hooni 2021.02.03 2759
210 Develop [js] Text 값을 클립보드에 복사하기 hooni 2020.10.10 783
209 Develop [js] Text 중 URL 형식을 인식해 단축 URL로 변경 file hooni 2013.04.23 8723
208 Develop [js] URL 파싱하기 (jQuery 안쓰고) hooni 2017.12.14 1434
207 Develop [js] window.open() 속성 사용 방법 hooni 2013.11.18 13630
206 Develop [js] 가운데 새창 뜨는 함수와 이벤트 hooni 2003.04.23 6742
Board Pagination Prev 1 ... 48 49 50 51 52 53 54 55 56 57 ... 71 Next
/ 71