[ios] Device UUID / UDID 가져오기 + ADID
UUID - Universally Unique Identifire ( 시간, 공간을 이용하여 뽑아낸 128bit (중복되지 않는) 값 )
GUID - Globaly Unique Identifire ( UUID 와 같은 MS 에서 사용하는 값 )
UDID - Unique Device Identifire ( 기기 별 고유 식별 값 )
NSString* uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; // IOS 6+
NSLog(@"UDID:: %@", uniqueIdentifier);
보안상의 이유로 udid 수집이 ios6부터 사라졌다
+ (NSString *)deviceUUID
{
if([[NSUserDefaults standardUserDefaults] objectForKey:[[NSBundle mainBundle] bundleIdentifier]])
return [[NSUserDefaults standardUserDefaults] objectForKey:[[NSBundle mainBundle] bundleIdentifier]];
@autoreleasepool {
CFUUIDRef uuidReference = CFUUIDCreate(nil);
CFStringRef stringReference = CFUUIDCreateString(nil, uuidReference);
NSString *uuidString = (__bridge NSString *)(stringReference);
[[NSUserDefaults standardUserDefaults] setObject:uuidString forKey:[[NSBundle mainBundle] bundleIdentifier]];
[[NSUserDefaults standardUserDefaults] synchronize];
CFRelease(uuidReference);
CFRelease(stringReference);
return uuidString;
}
}
위에건 다른방법인데 논ARC ㅡㅡ...
UDID 를 얻고자 한다면 오픈 소스를 사용한다 아래 소스가 유명한듯

ylechelle/OpenUDID
[OpenUDID IS NOW DEPRECATED] Open source initiative for a universal and persistent UDID solution for iOS
github.com
https://github.com/ylechelle/OpenUDID
ylechelle/OpenUDID
[OpenUDID IS NOW DEPRECATED] Open source initiative for a universal and persistent UDID solution for iOS - ylechelle/OpenUDID
github.com
+ 이사하면서 본건데,, uuid 로 가져오거나 유틸을 이용해서 udid를 가져올 수 있고
IDFA(애플 광고서비스) 를 사용하는 앱인 경우에는 ADID로 사용자를 구분하면 된다!
참고로 안드로이드나 구글 서비스를 이용하는 경우에는 GAID 가 있으니 (Google Advertising ID) 그걸 참고하면 될듯하다!