Contents

Develop
2016.05.13 11:17

[ios] UUID 생성 + Key Chain 연동

Views 4769 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] 사진첩에 쓸 내용 - 마우스 오버로 바꾸기 hooni 2013.04.23 6356
216 Develop [c][php] 프로세스정보와 메모리 정보 웹으로 출력하는거.. file hooni 2013.04.23 6337
215 Develop [java] 에디터.. swing 사용 file hooni 2013.04.23 6326
214 Develop [js] 서서히 나타나는 화면.. ㅋㅋ hooni 2013.04.23 6218
213 Develop [doc] C++언어 문법 설명서 file hooni 2013.04.23 6188
212 Develop [js] 자바스크립트 escape()를 PHP로 받기 hooni 2013.04.23 6001
211 Develop [c] 윈도우 API Viewport와 Window file hooni 2013.04.23 5975
210 Develop [ios] Using protobuf(Protocol Buffers) on iPhone (iOS) file hooni 2014.03.20 5008
209 Develop [PHP] MacOS에서 PHP 7 설치하기 file hooni 2018.05.11 4994
208 Develop [android] 안드로이드 동영상 스트리밍 예제 2 hooni 2015.01.02 4910
207 Develop [ios] UITableView 특정 Row만 Update hooni 2014.04.08 4836
» Develop [ios] UUID 생성 + Key Chain 연동 file hooni 2016.05.13 4769
Board Pagination Prev 1 ... 48 49 50 51 52 53 54 55 56 57 ... 71 Next
/ 71