【问题标题】:identifierForVendor property returning undefined for iOSidentifierForVendor 属性返回未定义的 iOS
【发布时间】:2016-01-19 09:42:46
【问题描述】:

我们得到未定义的 identifierForVendor 值。 iOS 应用使用 iOS9.2 和 Corodva 5.3.1 编译。有什么可能的原因吗?应用程序在上次发布之前一直可以正常工作。

【问题讨论】:

  • 你需要显示你正在使用的代码。
  • 在答案中添加了代码
  • 嗯,好吧,我不太明白,但如果您将其添加为答案,那么您必须准备就绪。
  • +(NSString*)uniqueIDForDevice { NSString* uniqueIdentifier = nil; if( [UIDevice instancesRespondToSelector:@selector(identifierForVendor)] ) { // >=iOS 7 uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; } else { //
  • 听起来您正在尝试构建一个插件 - 对吗?

标签: cordova mobile plugins uniqueidentifier ios9.2


【解决方案1】:

只需使用最新版本的cordova-plugin-device

device.uuid 现在返回identifierForVendor

https://www.npmjs.com/package/cordova-plugin-device

【讨论】:

  • 谢谢 试试这个..知道它在哪个版本中改变了吗?现在不推荐使用 identifierForVendor 了吗?
  • 在开发过程中是否有机会将 uuid 的值设为 0?
  • 好像有bug,在某些设备上可以返回0000...stackoverflow.com/questions/12605257/…
  • 是的,但是那个线程是 2012 年的。现在应该修复了。我已经按照你的建议实现了新版本的设备插件。现在得到 0 作为 uuid。跨度>
  • 是否有可能在开发版本中我将其设为 0 并在发布到应用商店后获得适当的价值?
猜你喜欢
  • 1970-01-01
  • 2022-11-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多