2011-05-16 75 views
3

我想通過編程獲取iphone的UUID,並且還想將其存儲在我的數據庫中。如何通過iphone編程找到UUID?

我可以使用UUID來檢查應用程序是否被購買?

我該如何得到它?

+0

UDID或UUID?如果第一個,那麼它是在你的iPhone,並可以通過UIDevice類訪問。第二個是唯一標識符[CFUUID](http://developer.apple.com/library/ios/#documentation/CoreFoundation/Reference/CFUUIDRef/Reference/reference.html)。 – 2011-05-16 09:20:26

回答

7
NSString *udid = [[UIDevice currentDevice] uniqueIdentifier]; 

花了五秒鐘,找到在文檔中的 「UDID」 的搜索。

不,您無法從UDID收集信息。

查看文檔以獲取有關UDID的更多信息。一般來說,UDID本身應該很少使用,因爲設備可以通過不同的iTunes帳戶傳遞給不同的人。

2

試試這個代碼:

UIDevice *device = [UIDevice currentDevice]; 
NSString *uniqueIdentifier = [device uniqueIdentifier]; 
1

使用下面

NSString *uuid = [[UIDevice currentDevice] uniqueIdentifier]; 
0
NSString * UDID = [[UIDevice currentDevice] uniqueIdentifier]; 
UDID = [UDID stringByReplacingOccurrencesOfString:@"-" withString:@""];