如何使用 C# 读取 Windows 上连接的 iOS 设备的 UDID?

How to read a UDID of the connected iOS device on Windows using C#?

能否建议如何在 Windows 上使用 C# 获取已连接 iOS 设备的 UDID?我试图在 Google 中搜索,但没有找到任何内容。有没有办法或解决方法?也许任何开源库或其他东西?

请推荐。

提前致谢。

问题来了,UDID 自 IOS 7 以来已被锁定,您不应该在您的代码中访问此 ID。有一些方法可以通过不可见的后台网页提取 ID,但这仅适用于您不打算在 iTunes 商店上发布您的应用程序的情况,因为您的应用程序将被拒绝。

2013 年,马特在他的博客 NSHipster (http://nshipster.com/uuid-udid-unique-identifier/) 中写道:

As of May 1st, Apple began enforcing this deprecation on all new app submissions, even for apps targeting earlier versions of iOS. Any use of uniqueIdentifier is grounds for immediate rejection of new binaries.

(如果您希望更详细地解释此更改的来龙去脉,请阅读 Mattt 博客文章的其余部分)

对此你能做些什么?没有什么。但是,如果您需要某种 ID 来做任何您想做的事情,那么您有两个选择:

identifierForVendor

此处:https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/identifierForVendor

The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.

Normally, the vendor is determined by data provided by the App Store. If the app was not installed from the app store (such as enterprise apps and apps still in development), then a vendor identifier is calculated based on the app’s bundle ID. The bundle ID is assumed to be in reverse-DNS format.

广告标识符

此处:https://developer.apple.com/library/ios/documentation/AdSupport/Reference/ASIdentifierManager_Ref/index.html#//apple_ref/occ/instp/ASIdentifierManager/advertisingIdentifier

Unlike the identifierForVendor property of the UIDevice, the same value is returned to all vendors. This identifier may change—for example, if the user erases the device—so you should not cache it.

If the value is nil, wait and get the value again later. This happens, for example, after the device has been restarted but before the user has unlocked the device.