獲得iPhone獨特的ID作為長期價值

[英]Getting iPhone unique id as long long value


I'm new to Iphone developing. I have next problem:

我是Iphone開發的新手。我有下一個問題:

I need to get unique id for every iPhone that runs my application.

我需要為運行我的應用程序的每個iPhone獲取唯一ID。

I found this great project on github: https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5 These functions return string of 32 characters which represents some hexadecimal value.

我在github上找到了這個很棒的項目:https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5這些函數返回32個字符的字符串,表示一些十六進制值。

Does someone have an idea how could I get unsigned long long value (64bit integer value) from this string?

有人知道如何從此字符串中獲取無符號長long值(64位整數值)?

Thanks

3 个解决方案

#1


2  

Please note that as for iOS 5, getting the device's UUID is deprecated by Apple and unless you're working on an in-house project, you should not do it. Apple apparently started rejecting apps doing it with no proper reason.

請注意,對於iOS 5,Apple不推薦使用設備的UUID,除非您正在進行內部項目,否則不應該這樣做。蘋果公司似乎開始拒絕沒有正當理由的應用程序。

The best way to uniquely identify your users is by generating a GUID at startup. Please see this SO thread : UIDevice uniqueIdentifier Deprecated - What To Do Now?

唯一標識用戶的最佳方法是在啟動時生成GUID。請看這個SO線程:UIDevice uniqueIdentifier已棄用 - 現在該怎么辦?

#2


1  

You cannot fit 32 unicode characters (every one has 2 bytes, that is 64 bytes in total) into a long long which has only 8 bytes.

您不能將32個unicode字符(每個字符總共有2個字節,即總共64個字節)放入一個只有8個字節的long long中。

#3


0  

Luzal is right...getting the device's UDID is deprecated by Apple.

Luzal是對的...... Apple不推薦使用設備的UDID。

You also can use the OPEN UDID for uniquely identify your users..

您還可以使用OPEN UDID來唯一標識您的用戶。

downloads the classes from here- https://github.com/ylechelle/OpenUDID

從這里下載課程 - https://github.com/ylechelle/OpenUDID

import the class -

導入課程 -

#import "OpenUDID.h"

and use below code to get OPEN UDID

並使用下面的代碼來獲取OPEN UDID

NSString * uniqueStr = [OpenUDID value];
NSLog(@"%@",uniqueStr);

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/05/07/724dac5af6b8a98275a1760a7ef83668.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com