@@ -634,6 +634,9 @@ void mount_developer_image(AMDeviceRef device) {
634634}
635635
636636mach_error_t transfer_callback (CFDictionaryRef dict, int arg) {
637+ if (CFDictionaryGetValue (dict, CFSTR (" Error" ))) {
638+ return 0 ;
639+ }
637640 int percent;
638641 CFStringRef status = CFDictionaryGetValue (dict, CFSTR (" Status" ));
639642 CFNumberGetValue (CFDictionaryGetValue (dict, CFSTR (" PercentComplete" )), kCFNumberSInt32Type , &percent);
@@ -661,6 +664,9 @@ mach_error_t transfer_callback(CFDictionaryRef dict, int arg) {
661664}
662665
663666mach_error_t install_callback (CFDictionaryRef dict, int arg) {
667+ if (CFDictionaryGetValue (dict, CFSTR (" Error" ))) {
668+ return 0 ;
669+ }
664670 int percent;
665671 CFStringRef status = CFDictionaryGetValue (dict, CFSTR (" Status" ));
666672 CFNumberGetValue (CFDictionaryGetValue (dict, CFSTR (" PercentComplete" )), kCFNumberSInt32Type , &percent);
@@ -681,21 +687,24 @@ mach_error_t install_callback(CFDictionaryRef dict, int arg) {
681687// use this callback to determine which step is occuring and call the proper
682688// callback.
683689mach_error_t incremental_install_callback (CFDictionaryRef dict, int arg) {
684- CFStringRef status = CFDictionaryGetValue (dict, CFSTR (" Status" ));
685- if (CFEqual (status, CFSTR (" TransferringPackage" ))) {
686- int percent;
687- CFNumberGetValue (CFDictionaryGetValue (dict, CFSTR (" PercentComplete" )), kCFNumberSInt32Type , &percent);
688- int overall_percent = (percent / 2 );
689- NSLogOut (@" [%3d%% ] %@ " , overall_percent, status);
690- NSLogJSON (@{@" Event" : @" TransferringPackage" ,
691- @" OverallPercent" : @(overall_percent),
692- });
693- return 0 ;
694- } else if (CFEqual (status, CFSTR (" CopyingFile" ))) {
695- return transfer_callback (dict, arg);
696- } else {
697- return install_callback (dict, arg);
698- }
690+ if (CFDictionaryGetValue (dict, CFSTR (" Error" ))) {
691+ return 0 ;
692+ }
693+ CFStringRef status = CFDictionaryGetValue (dict, CFSTR (" Status" ));
694+ if (CFEqual (status, CFSTR (" TransferringPackage" ))) {
695+ int percent;
696+ CFNumberGetValue (CFDictionaryGetValue (dict, CFSTR (" PercentComplete" )), kCFNumberSInt32Type , &percent);
697+ int overall_percent = (percent / 2 );
698+ NSLogOut (@" [%3d%% ] %@ " , overall_percent, status);
699+ NSLogJSON (@{@" Event" : @" TransferringPackage" ,
700+ @" OverallPercent" : @(overall_percent),
701+ });
702+ return 0 ;
703+ } else if (CFEqual (status, CFSTR (" CopyingFile" ))) {
704+ return transfer_callback (dict, arg);
705+ } else {
706+ return install_callback (dict, arg);
707+ }
699708}
700709
701710CFURLRef copy_device_app_url (AMDeviceRef device, CFStringRef identifier) {
0 commit comments