2013-01-08 23 views

回答

0

您可以使用CFManzana/Manaza或MobileDevice DLL來連接iPhone。下面是一個例子,你可以做到這一點。

// this variable will be declared in your class . 

public static string devicename; 

CFManzana.iDevice 
phone = New iDevice(); 
phone.connect += phone_connect; 

void phone_connect(object sender, ConnectEventArgs args) 
     { 
// here your will add your exception handling details. 
      } 

// now extract your device details. 

devicename = phone.getDeviceName or phone.CopyValue("DeviceName"); \\it all depends what version of Manzana you have downloaded. 

//now assign the value to the field 

this.txtname.text = devicename; 

0

如果您想通過USB從Windows連接到iOS設備上,你可以嘗試imobiledevice網NuGet包,這是我保持。例如,要列出當前連接到PC的所有iOS設備,您可以這樣做:

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) 
{ 
    iDeviceHandle deviceHandle; 
    idevice.idevice_new(out deviceHandle, udid).ThrowOnError(); 

    LockdownClientHandle lockdownHandle; 
    lockdown.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, "Quamotion").ThrowOnError(); 

    string deviceName; 
    lockdown.lockdownd_get_device_name(lockdownHandle, out deviceName).ThrowOnError(); 

    deviceHandle.Dispose(); 
    lockdownHandle.Dispose(); 
}