Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

Views 4661 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
965 PPT [ppt] iOS 플라랩#02(2015.03.19) 발표 자료 file hooni 2015.04.24 898
964 Etc WM미통기 - 10. 조건부확률 hooni 2015.04.20 705
963 Etc 수리통계학 : 표본공간과 사상-1 hooni 2015.04.20 900
962 Etc EBS [수학영역] 미적분과 통계 기본 - 정규분포의 의미와 특징은? hooni 2015.04.20 1001
961 Develop [js] e.stopPropagation() VS e.preventDefault () file hooni 2015.04.14 808
960 Develop [js] 모바일 스크롤 방지(해제) hooni 2015.04.14 1588
959 Develop [js] 스크롤 이벤트 막기 hooni 2015.04.14 1007
958 Develop [ios] 앱에서 설정화면 호출하기 hooni 2015.04.07 745
957 Develop [ios] GMT Date와 Local Date 변환하기 hooni 2015.04.07 827
956 Etc 아이폰의 터치스크린 정확도 file hooni 2015.04.01 1411
955 Develop [ios] 아이폰 앱 이름 및 버전 정보 hooni 2015.03.24 847
954 Develop [ios] 카메라 사용 권한 확인해서 분기하는 방법 hooni 2015.02.26 1869
953 PPT [ppt] iOS 플라랩#01(2015.02.26) 발표 자료 file hooni 2015.02.25 729
952 Develop [ios] Touch ID 적용 샘플 코드 (예제) file hooni 2015.02.23 666
951 Develop [펌] 게임 엔진 만든거 공개합니다. hooni 2015.02.21 2352
950 Develop [ios] StoryBoard(xib) 없이 프로젝트 만들기 file hooni 2015.02.12 1065
Board Pagination Prev 1 ... 12 13 14 15 16 ... 74 Next
/ 74