Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 10197 댓글 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;
}



?

  1. [c] Mac OS 에 gmp(gmp.h) 라이브러리 설치

    Date2016.10.03 CategoryDevelop Byhooni Views5064
    Read More
  2. [c] 셀프 넘버(Self Number) 구하기

    Date2016.09.09 CategoryDevelop Byhooni Views3833
    Read More
  3. [android] Android N requires the IDE to be running with Java 1.8 or later 오류

    Date2016.08.30 CategoryDevelop Byhooni Views2788
    Read More
  4. [c] 파일명 또는 특정 패턴을 적용

    Date2016.08.03 CategoryDevelop Byhooni Views2412
    Read More
  5. [ios] Crashlytics, Fabfic 설치/설정

    Date2016.07.21 CategoryDevelop Byhooni Views2367
    Read More
  6. [ios] 새로 만들고 있는 DateMemo

    Date2016.07.12 CategoryDevelop Byhooni Views1903
    Read More
  7. [ios][swift] 초간단 카달로그 앱 (Catalog App)

    Date2016.06.27 CategoryDevelop Byhooni Views14313
    Read More
  8. [ios][swift] 초간단 To-do Memo

    Date2016.06.27 CategoryDevelop Byhooni Views11041
    Read More
  9. [ios][swift] 초간단 TableView 샘플

    Date2016.06.27 CategoryDevelop Byhooni Views5291
    Read More
  10. [ios] 웹뷰 history.back() ㅋㄷ

    Date2016.06.27 CategoryDevelop Byhooni Views5674
    Read More
  11. [ios] 기본 네비게이션바의 타이틀, back버튼 위치와 속성 변경

    Date2016.05.16 CategoryDevelop Byhooni Views5180
    Read More
  12. [ios] UUID 생성 + Key Chain 연동

    Date2016.05.13 CategoryDevelop Byhooni Views10197
    Read More
Board Pagination Prev 1 ... 3 4 5 6 7 8 9 10 11 12 ... 71 Next
/ 71