简体   繁体   English

iPhone 设备 UUID - PhoneGap

[英]iPhone Device UUID - PhoneGap

I'm trying to get the UUID on iPhone 4.x simulator, however device.uuid stops my app from running.我正在尝试在 iPhone 4.x 模拟器上获取 UUID,但是device.uuid阻止我的应用程序运行。 I've also tried DeviceInfo.uuid but this returns undefined despite being able to see the uuid in the DeviceInfo object in the debugger console.我也尝试过DeviceInfo.uuid ,但尽管能够在调试器控制台中看到 DeviceInfo object 中的 uuid,但仍返回 undefined。

Any ideas what I should be using?任何想法我应该使用什么?

I'm using PhoneGap 1.0.0我正在使用 PhoneGap 1.0.0

Thanks!谢谢!

Its important to note the difference between a UDID and a UUID.请务必注意 UDID 和 UUID 之间的区别。

UDID "unique device id" is hardware specific. UDID“唯一设备 ID”是特定于硬件的。 It never changes for a particular device.对于特定设备,它永远不会改变。 For this reason, it has become a privacy concern and Apple is blocking apps that try to use this.出于这个原因,它已经成为一个隐私问题,Apple 正在阻止尝试使用它的应用程序。 As a result, Apple has generated an opt-out-able "device id" hash, particularly for advertisement usage.因此,Apple 生成了一个可选择退出的“设备 ID”hash,特别是用于广告用途。 This new ID hash is called IFA and is available in iOS 6.0+.这个新的 ID hash 称为 IFA,在 iOS 6.0+ 中可用。

UUID "universally unique id" is not hardware specific. UUID“通用唯一ID”不是硬件特定的。 It is a hash used to identify a device;它是一个 hash 用于识别设备; but not particularly an absolute value.但不是一个绝对值。 PhoneGap generates a UUID based on device properties; PhoneGap 根据设备属性生成 UUID; this is what you get when you do device.uuid.这就是您执行 device.uuid 时得到的结果。 If you delete the app and reinstall, you will get a new id hash.如果您删除该应用并重新安装,您将获得一个新的 ID hash。 UUID is not being blocked by Apple . UUID 没有被 Apple 阻止

I experienced the same problem, not just with device.uui , but with other events.我遇到了同样的问题,不仅是device.uui ,还有其他事件。 In my case the problem was that XCode 4 put a reference in the html file to phonegap.js instead of phonegap.{ver}.js .在我的情况下,问题是 XCode 4 在 html 文件中引用了phonegap.js而不是phonegap.{ver}.js

It is a vague idea but: I think you actually cannot get an UUID from the simulator?这是一个模糊的想法,但是:我认为您实际上无法从模拟器中获取 UUID?

It could be that the simulator does not offer the same underlying architecture as a real device does.可能是模拟器没有提供与真实设备相同的底层架构。

And because a UUID is UNIQUE abd considering the fact that there are thousands of people using the simulator with Xcode I highly doubt apple would ship a unique UUID with every simulator, too.而且因为 UUID 是唯一的,考虑到有成千上万的人使用带有 Xcode 的模拟器这一事实,我非常怀疑苹果是否会为每个模拟器提供一个唯一的 UUID。

Have you tried using a actual device?您是否尝试过使用实际设备?

HTH高温高压

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM