1

I need to install a .mobileconfig file into iPhone as a profile, similar to how AppleConfigurator does it but I don't own a MAC. I don't know where it default installs to, should there be options included? The goal is to skip the Setup Assistant that takes place with each newly erased phone.

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)
{

    return;
}

ret.ThrowOnError();

// Get the device serial
foreach (var udid in udids)
{
    LockdownClientHandle lockdownHandle;
    iDeviceHandle deviceHandle;
    LockdownServiceDescriptorHandle ldsHandle;

    idevice.idevice_new(out deviceHandle, udid).ThrowOnError();

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

    InstallationProxyClientHandle ipc;

    lockdown.lockdownd_start_service(lockdownHandle, 
        "com.apple.mobile.installation_proxy", out ldsHandle);

    ldsHandle.Api.InstallationProxy.instproxy_client_new(deviceHandle, 
        ldsHandle, out ipc);

    ldsHandle.Api.InstallationProxy.instproxy_install(ipc,

    @"C:\configFile.mobileconfig",PlistHandle.Zero,Callback,IntPtr.Zero);
}

1 Answers1

1

The method you use, instproxy_install, is used to install applications. libimobiledevice also ships with imobileprovision, which is used to install provisioning profiles. But you're attempting to install mobile configuration profiles, which is something different.

libimobiledevice doesn't provide an API for working with mobile configuration profiles. There are a couple of commercial vendors which can help. The company I work for provides the imobileconfig command-line utility. I believe some of the folks on the core libimobiledevice team also do consultancy in this area.

One a related note, pushing a mobile configuration profiles will cause the device to skip most of the installation wizard, but not all. Again, commercial vendors can help there if needed.

Frederik Carlier
  • 4,606
  • 1
  • 25
  • 36