ImagineLearning-Public / MobileDevice

Allows communication with iDevices. Fork from mobiledevice.codeplex.com, making use of house arrest service (as opposed to AFC) to transfer files to documents directory.
6 stars 9 forks source link

SingleSync project 5 syncs max #2

Closed MarkSiedle closed 11 years ago

MarkSiedle commented 11 years ago

Hi, Thanks for this great library.

We've hit a roadblock with the SingleSync project regarding re-syncing.

For our application, we need to re-sync multiple times from the same process.

In Program.cs, if we add a "_finished = true;" at the end of the .DeviceDiscovered event handler, I can hit "1" to start again and it's successful. But after 5 syncs, iPhone.ConnectViaHouseArrest suddenly dies saying it's "Unable to find bundle with id ...".

Eg.


phoneManager.DeviceDiscovered += (s, e) =>
{
    e.iPhone.ConnectViaHouseArrest(options.BundleIdentifier);

    //...

    // Flag as finished so we can hit start again from the same process
    _finished = true;
};

If we close and restart the process, no dramas (you get another 5 syncs). But ideally we need to re-sync indefinitely from the same process for our application.

Just wondering if you've seen this issue, or know a way around it?

Any advice appreciated. Thanks Mark

dmmatson commented 11 years ago

Mark,

The omission of the finished flag was an error on my part and must have been due to some regression since it did work at one point. You can either submit a pull request or I will fix that in the next couple days.

Admittedly I've never run the SingleSync tool more than twice sequentially so I haven't seen the problem you are experiencing. I'd have a hard time believing it is due to some inherent limitation in the iTunes DLL so there may be an issue with the tool itself or the MobileDevice library. I won't have access to an iPad to test until tomorrow but I will try to look into it then.

As a workaround, you may not have the same problem if you only do GetiPhonesAsync+ConnectViaHouseArrest once and then reuse the iPhone object every time you do a copy afterward. I don't think there is a reason to reconnect after a sync operation if complete.

On Wed, Oct 23, 2013 at 5:31 PM, Mark Siedle notifications@github.comwrote:

Hi, Thanks for this great library.

We've hit a roadblock with the SingleSync project regarding re-syncing.

For our application, we need to re-sync multiple times from the same process.

In Program.cs, if we add a "_finished = true;" at the end of the .DeviceDiscovered event handler, I can hit "1" to start again and it's successful. But after 5 syncs, iPhone.ConnectViaHouseArrest suddenly dies saying it's "Unable to find bundle with id ...".

Eg.

phoneManager.DeviceDiscovered += (s, e) => { e.iPhone.ConnectViaHouseArrest(options.BundleIdentifier);

//...

// Flag as finished so we can hit start again from the same process
_finished = true;

};

If we close and restart the process, no dramas (you get another 5 syncs). But ideally we need to re-sync indefinitely from the same process for our application.

Just wondering if you've seen this issue, or know a way around it?

Any advice appreciated. Thanks Mark

— Reply to this email directly or view it on GitHubhttps://github.com/ImagineLearning-Public/MobileDevice/issues/2 .

MarkSiedle commented 11 years ago

As a workaround, you may not have the same problem if you only do GetiPhonesAsync+ConnectViaHouseArrest once and then reuse the iPhone object every time you do a copy afterward. I don't think there is a reason to reconnect after a sync operation if complete.

Thanks David, that worked :-)

Maybe it's something within iTunesMobileHelper that doesn't let you subscribe more than five times using AMDeviceNotificationSubscribe. Or maybe we need to balance subscribe calls with an unsubscribe if we reconnect each time (assuming such a method is available?). Either way, we should be able to rearrange our project to only connect once. Cheers