uniqueIdentifier deprecate
Posted 2011/09/23 18:02iOS 5의 UIDevice 클래스 레퍼런스를 보면, 위 그림과 같이, uniqueIdentifier 메서드를 이젠 더 이상 사용할 수 없으니 CFUUIDCreate 함수를 이용하여, UUID를 생성하여, NSUserDefaults에 저장하여 사용하란다.
그래서 NSMutableString에 카테고리를 추가해 보았다.
[NSMutableString+GUID.h]
#import <Foundation/Foundation.h>
@interface NSMutableString (GUID)
- (void)appendGuid;
+ (id)stringWithGuid;
@end
[NSMutableString+GUID.m]
#import "NSMutableString+GUID.h"
@implementation NSMutableString (GUID)
- (void)appendGuid
{
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
NSString *str = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
[self appendString:str];
CFRelease(uuid);
}
+ (id)stringWithGuid;
{
NSMutableString *ret = [self string];
[ret appendGuid];
return ret;
}
@end
'iOS' 카테고리의 다른 글
| iOS 5: NSJSONSerialization 사용하기 (0) | 2011/10/20 |
|---|---|
| iOS Boilerplate A base template for iOS apps 소개 (0) | 2011/09/29 |
| uniqueIdentifier deprecate (2) | 2011/09/23 |
| iOS4의 IBOutletCollection 사용법 (0) | 2011/09/08 |
| 아이폰에서 쿠키 읽기 (0) | 2011/07/11 |
| iOS에서 쿠키 사용하기 (0) | 2011/05/27 |