Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

조회 수 4670 댓글 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. [ios] 카테고리 확장 메소드를 찾지 못하는 경우

    Date2014.08.08 CategoryDevelop Byhooni Views2001
    Read More
  2. [ios] Swift 4 Dictionary 사용하기

    Date2018.11.29 CategoryDevelop Byhooni Views2031
    Read More
  3. [java] netty (비동기 이벤트 방식 네트워크 프레임워크) 사용법 #2 (client)

    Date2015.01.02 CategoryDevelop Byhooni Views2045
    Read More
  4. [ios] 설정에서 푸시 알림(APNS) on/off 상태 확인

    Date2015.04.28 CategoryDevelop Byhooni Views2049
    Read More
  5. [c#] mfc 기반의 웹서비스 서버/클라이언트 샘플과 예제 소스

    Date2013.04.23 CategoryDevelop Byhooni Views2073
    Read More
  6. [android] SQLiteOpenHelper를 이용한 DBManager

    Date2017.06.14 CategoryDevelop Byhooni Views2077
    Read More
  7. [c#] MS IE(Internet Explorer) 툴바 버튼 예제 2003/2005 두가지 버전

    Date2013.04.23 CategoryDevelop Byhooni Views2090
    Read More
  8. [ios] 기본 네비게이션바의 타이틀, back버튼 위치와 속성 변경

    Date2016.05.16 CategoryDevelop Byhooni Views2095
    Read More
  9. [android] 안드로이드 앱 문서 샘플

    Date2017.07.11 CategoryDevelop Byhooni Views2111
    Read More
  10. [c#] 툴바 최근 버전(IE6, IE7 두가지 버전)

    Date2013.04.23 CategoryDevelop Byhooni Views2138
    Read More
  11. [android] 버전 별 앱 알림 설정으로 이동하는 방법

    Date2016.11.28 CategoryDevelop Byhooni Views2164
    Read More
  12. [c#] BHO 한샘툴바랑 동현툴바..

    Date2013.04.23 CategoryDevelop Byhooni Views2208
    Read More
Board Pagination Prev 1 ... 8 9 10 11 12 13 14 15 16 17 ... 71 Next
/ 71