2012-03-30 44 views
1

我想檢查用戶是否已經爲特定頁面投票,這是通過檢查數據庫中是否存在設備uuid來完成的,因此任何人都可以幫助我找到手機中的設備uuid並使用該設備uuid來檢查在馬php腳本?如何通過phonegap找到uuid的iphone?

回答

0

檢查Phonegap文檔。

http://docs.phonegap.com/en/1.5.0/phonegap_device_device.md.html#Device

function onDeviceReady() { 
     var element = document.getElementById('deviceProperties'); 

     element.innerHTML = 'Device Name: '  + device.name  + '<br />' + 
          'Device PhoneGap: ' + device.phonegap + '<br />' + 
          'Device Platform: ' + device.platform + '<br />' + 
          'Device UUID: '  + device.uuid  + '<br />' + 
          'Device Version: ' + device.version + '<br />'; 
    } 
+0

可以告訴我應該在哪裏使用這段代碼?我的意思是它在js文件或html? – user1285402 2012-03-30 08:24:40

+0

在HTML文件... – iPrabu 2012-03-30 08:26:32

+0

請注意,UDID已被棄用,蘋果開始還是用它來拒絕的應用程序。 – rckoenes 2012-03-30 08:28:59

4

我會盡量避免使用UUID,蘋果可能會拒絕你的申請,如果你使用它。使用替代方法來識別單個用戶。

TechCrunch reports that Apple has begun rejecting iOS apps for the use of a 
unique device identifier known as the UDID. The site notes that several developers 
have reported rejections for the use of the UDID in the past week, and Apple is said 
to be ramping up the enforcement of this policy over the next few weeks. 

來源:http://forums.macrumors.com/showthread.php?t=1348294

+0

感謝您的信息 – user1285402 2012-03-30 08:33:30

+0

,所以我們不應該在有應用程序使用設備UUID?或者是有使用它的任何其他方式? – user1285402 2012-03-30 08:37:16

+0

你應該避免使用它。 – ader 2012-03-30 09:07:25

2

它必須注意一個UDID和UUID之間的區別。

UDID「唯一設備ID」是硬件特定的。它永遠不會改變一個特定的設備。出於這個原因,它已成爲一個隱私問題,蘋果正在阻止試圖使用它的應用程序。因此,Apple已經生成了一個選擇退出的「設備ID」哈希,特別是對於廣告使用。這個新的ID散列稱爲IFA,可在iOS 6.0或更高版本中使用。這是一個公平的選擇,但可以隨時由用戶禁用。

UUID「通用唯一ID」不是硬件特定的。它是用來識別設備的散列。但不是絕對的價值。 PhoneGap根據設備屬性生成一個UUID;這是您在執行device.uuid時所得到的結果。如果你刪除了應用程序並重新安裝,你會得到一個新的ID散列。 UUID未被Apple阻止。