Skip to content
.NET (C#, VB.NET,...) bindings for libimobiledevice
Branch: master
Clone or download
Latest commit e7cba83 Jan 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Add DocFX template Jan 11, 2018
iMobileDevice-net.Demo Use a .NET Core project for iMobileDevice-net.Demo Mar 21, 2018
iMobileDevice-net Re-generate code - the libusbmuxd API has been updated Oct 22, 2018
iMobileDevice.Generator.Tests Set up CI with Azure Pipelines Oct 2, 2018
iMobileDevice.Generator Fixed the end tag for element 'summary'. Oct 10, 2018
iMobileDevice.IntegrationTest.netcoreapp20 Run integration tests on macOS Sep 12, 2018
iMobileDevice.IntegrationTests.net45 Run integration tests on macOS Sep 12, 2018
iMobileDevice.Tests Set up CI with Azure Pipelines Oct 2, 2018
iMobileDevice/iDevice Fix issue for delegate arguments Sep 20, 2016
licenses Add libzip license, remove zlib license Apr 5, 2016
runtime.win7-x64.vcruntime140 Bump version number, build packages during AppVeyor build Oct 16, 2017
runtime.win7-x86.vcruntime140 Bump version number, build packages during AppVeyor build Oct 16, 2017
steps irecovery doesn't support --help Oct 3, 2018
.gitignore Run tests in AppVeyor Aug 27, 2018
.travis.yml Run integration tests on macOS Sep 12, 2018
LICENSE.txt Add license information Apr 4, 2016
README.md Update README.md Dec 18, 2018
UpdateNuGetFile.ps1 Fix project.json references Sep 20, 2016
appveyor.yml Run integration tests on macOS Sep 12, 2018
azure-pipelines.yml Bump dependencies Jan 22, 2019
download.cmd Bump libideviceactivation version Aug 28, 2018
iMobileDevice.NET.sln Prepare migration to Nustache for code generation Aug 19, 2018
version.json Publish to NuGet from master Aug 25, 2018

README.md

.NET bindings for imobiledevice

Build Status NuGet Status

imobiledevice-net is a library which allows you to interact with iOS devices on Windows using any of the .NET Framework languages (such as C# or Visual Basic). It is based on the libimobiledevice library.

Installing

You can install imobiledev-net as a NuGet package

PM> Install-Package imobiledevice-net

Advantages of imobiledevice-net

We've done some work to make sure imobiledevice-net "just works":

  • Better string handling: Strings are marshalled (copied from .NET code to unmanaged code and vice versa) as UTF-8 strings. This is what libimobiledevice uses natively.
  • Better array handling: In most cases, we'll return a ReadOnlyCollection<string> object instead of IntPtr objects when the native API returns an array of strings.
  • Less memory leaks: We give you safe handles instead of IntPtr objects. When you dispose of the safe handle (or you forget, and the framework does it for you), the safe memory is freed, too.
  • Unit testing support: You interact with libimobiledevice through classes such as iDevice or Lockdown. For each of these classes, we also expose an interface, allowing you to unit test your code.
  • XML Documentation: Where possible, we've copied over the documentation of libimobiledevice to imobiledevice-net, giving you IntelliSense support.

How it works

We use libclang to parse the libimobiledevice C headers and generate the C# P/Invoke code.

Documentation

See the API Documentation for more information on imobiledevice-net.

Getting started

Using the library

Before you use the library, you must call NativeLibraries.Load() so that libimobiledevice is loaded correctly:

NativeLibraries.Load();

Listing all iOS devices

The following snippit lists all devices which are currently connected to your PC:

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();
}

Binary distributions of libimobiledevice for Windows, macOS and Ubuntu Linux

We also provide binary distributions of libimobiledevice for Windows, macOS, and Ubuntu Linux.

For Windows and macOS, you can download a zip file with the libimobiledevice libraries and tools using the links below. For Ubuntu Linux, you can use our PPA (package archive) to install the latest libimobiledevice libraries and tools using apt-get.

Supported Platform Downloads CI
Windows (x86) libimobiledevice-1.2.1-win-x86.zip AppVeyor
Windows (x64) libimobiledevice-1.2.1-win-x64.zip AppVeyor
macOS (x64) libimobiledevice-1.2.1-osx-x64.zip Travis
Ubuntu (x64) Quamotion PPA Travis

VCPKG repositories

If you want to install libimobiledevice from source on Windows, you can also use vcpkg. Follow the instructions on the VCPKG repository to install VCPKG. You can then install the 32-bit or 64-bit version of libimobiledevice using the following commands:

vcpkg install --head libplist:x86-windows libusbmuxd:x86-windows libimobiledevice:x86-windows usbmuxd:x86-windows ideviceinstaller:x86-windows libideviceactivation:x86-windows"
vcpkg install --head libplist:x64-windows libusbmuxd:x64-windows libimobiledevice:x64-windows usbmuxd:x64-windows ideviceinstaller:x64-windows libideviceactivation:x64-windows"

Make sure to use --head so you get the latest version of libimobiledevice!

Consulting, Training and Support

This repository is maintained by Quamotion. Quamotion develops test software for iOS and Android applications, based on the WebDriver protocol.

Quamotion offers various technologies related to automating iOS devices using computers running Windows or Linux. This includes:

  • The ability to remotely control iOS devices
  • Extensions to libimobiledevice with support for the Instruments protocol
  • Running Xcode UI Tests and Facebook WebDriverAgent tests

In certain cases, Quamotion also offers professional services - such as consulting, training and support - related to imobiledivice-net and libimobiledevice.

Contact us at info@quamotion.mobi for more information.

You can’t perform that action at this time.