Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

Views 4670 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;
}


?

  1. [c] 단어 입력/수정 프로그램 소스

  2. [c] openssl 샘플코드.. 어려움 ㅠㅠ

  3. [c++] 소켓 프로그래밍 관련 링크.. (퍼올려고 올린거)

  4. [C++] 18일차 과제물, String 클래스 디자인 【 C++ 문제 】

  5. [c] 텍스트 파일(로그)을 정해진 라인 단위로 쪼개주는 코드

  6. [c++] mfc 기반 멀티수납(wall)시스템 소스와 실행파일

  7. [js] 툴팁.. 좋은거.. (tooltip)

  8. [c] 구조체/파일 입출력 프로그램

  9. [php] 초간단 웹 카운터..

  10. [asp] 기본 문법과 제어문

  11. [js] 2차 잉여.. (Quadratic reciprocity) 계산..

  12. [c] 단기과정[01/14] 피보나치, 파스칼.. 파일입출력

  13. [c] 베이지언(Bayesian) 패턴인식 과제 ㅋㅋ

  14. [c] 테트리스3D (Tetris 3D)

  15. [pdf] 포인터 문법 정리 (C pointer)

  16. [c++] 인라인 함수에 대한 설명

Board Pagination Prev 1 ... 24 25 26 27 28 ... 74 Next
/ 74