Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在C中获取连接的设备序列号#_C#_Ios_Iphone_Windows - Fatal编程技术网

C# 在C中获取连接的设备序列号#

C# 在C中获取连接的设备序列号#,c#,ios,iphone,windows,C#,Ios,Iphone,Windows,我正试图通过C#从连接的设备获取数据。具体来说,我需要从iOS设备获取序列号 我从附件的照片中看到了这些数据,但我正在寻找一种用C#获取这些信息的方法 有人知道如何在C#中访问此信息吗 提供了一个C#API,您可以使用它与连接到Windows、Linux或macOS机器的iOS设备进行交互 自述文件中有示例代码,可帮助您列出连接到PC的所有设备的UDID: ReadOnlyCollection<string> udids; int count = 0; var idevice =

我正试图通过C#从连接的设备获取数据。具体来说,我需要从iOS设备获取序列号

我从附件的照片中看到了这些数据,但我正在寻找一种用C#获取这些信息的方法

有人知道如何在C#中访问此信息吗

提供了一个C#API,您可以使用它与连接到Windows、Linux或macOS机器的iOS设备进行交互

自述文件中有示例代码,可帮助您列出连接到PC的所有设备的UDID:

ReadOnlyCollection<string> udids;
int count = 0;

var idevice = LibiMobileDevice.Instance.iDevice;
var lockdown = LibiMobileDevice.Instance.Lockdown;

var ret = idevice.idevice_get_device_list(out udids, ref count);

if (ret == iDeviceError.NoDevice)
{
    // Not actually an error in our case
    return;
}

ret.ThrowOnError();

// Get the device name
foreach (var udid in udids)
{
    Console.WriteLine(udid);
}
ReadOnlyCollection udid;
整数计数=0;
var idevice=LibiMobileDevice.Instance.idevice;
var lockdown=LibiMobileDevice.Instance.lockdown;
var ret=idevice.idevice\u get\u device\u list(out udid,ref count);
if(ret==iDeviceError.NoDevice)
{
//在我们的案例中,这实际上不是一个错误
返回;
}
ret.ThrowOnError();
//获取设备名称
foreach(udid中的变量udid)
{
控制台写入线(udid);
}

让我知道这是否有帮助

将下面的代码放在
锁定之后。通过握手(deviceHandle,out lockdownHandle,“Quamotion”)。ThrowOnError()您将能够访问序列号或iOS版本等值。这只是一个粗略的例子:

    string t1;
    string t2;

    PlistHandle tested1;
    PlistHandle tested2;

    //Find serial number in plist
    lockdown.lockdownd_get_value(lockdownHandle, null, "SerialNumber", out 
    tested1);

    //Find IOS version in plist
    lockdown.lockdownd_get_value(lockdownHandle, null, "ProductVersion", out 
     tested2);

    //Get string values from plist
    tested1.Api.Plist.plist_get_string_val(tested1, out t1);
    tested2.Api.Plist.plist_get_string_val(tested2, out t2);

    //Place data in textboxes
    serialTXT.Text = t1.Trim();
    verTXT.Text = t2.Trim();

您需要有
NativeLibraries.Load(),然后使用引用拉入任何必要的iMobileDevice。

@stijn看起来问题是为了澄清而编辑的。在任何情况下-都是我能找到的,也许在源代码中是直接的答案。