Skip to content

Commit c4b5d1b

Browse files
Fix an issue introduced by #503 where installing an IPA requires explicitly providing a bundle id. The bundle id is used to determine the final install location so it can be printed but is not otherwise required. (#569)
1 parent 7a29ab0 commit c4b5d1b

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

src/ios-deploy/ios-deploy.m

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,16 +2733,7 @@ void handle_device(AMDeviceRef device) {
27332733
NSLogOut(@"------ Install phase ------");
27342734
NSLogOut(@"[ 0%%] Found %@ connected through %@, beginning install", device_full_name, device_interface_name);
27352735

2736-
CFStringRef install_bundle_id = NULL;
2737-
if (bundle_id != NULL) {
2738-
install_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
2739-
} else {
2740-
CFStringRef extracted_bundle_id = copy_bundle_id(url);
2741-
if (extracted_bundle_id == NULL) {
2742-
on_error(@"[ ERROR] Could not determine bundle id.");
2743-
}
2744-
install_bundle_id = extracted_bundle_id;
2745-
}
2736+
CFStringRef install_bundle_id = bundle_id == NULL ? copy_bundle_id(url) : CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
27462737

27472738
CFDictionaryRef options;
27482739
if (app_deltas == NULL) { // standard install
@@ -2756,6 +2747,9 @@ void handle_device(AMDeviceRef device) {
27562747
check_error(AMDeviceStopSession(device));
27572748
check_error(AMDeviceDisconnect(device));
27582749
} else { // incremental install
2750+
if (install_bundle_id == NULL) {
2751+
on_error(@"[ ERROR] Could not determine bundle id.");
2752+
}
27592753
CFStringRef deltas_path =
27602754
CFStringCreateWithCString(NULL, app_deltas, kCFStringEncodingUTF8);
27612755
CFURLRef deltas_relative_url =
@@ -2797,24 +2791,32 @@ void handle_device(AMDeviceRef device) {
27972791

27982792
CFRelease(options);
27992793

2800-
connect_and_start_session(device);
2801-
CFURLRef device_app_url = copy_device_app_url(device, install_bundle_id);
2802-
check_error(AMDeviceStopSession(device));
2803-
check_error(AMDeviceDisconnect(device));
2804-
CFStringRef device_app_path = CFURLCopyFileSystemPath(device_app_url, kCFURLPOSIXPathStyle);
2805-
28062794
NSLogOut(@"[100%%] Installed package %@", [NSString stringWithUTF8String:app_path]);
2807-
NSLogVerbose(@"App path: %@", device_app_path);
2808-
NSLogJSON(@{@"Event": @"BundleInstall",
2809-
@"OverallPercent": @(100),
2810-
@"Percent": @(100),
2811-
@"Status": @"Complete",
2812-
@"Path": (__bridge NSString *)device_app_path
2813-
});
2795+
if (install_bundle_id == NULL) {
2796+
NSLogJSON(@{@"Event": @"BundleInstall",
2797+
@"OverallPercent": @(100),
2798+
@"Percent": @(100),
2799+
@"Status": @"Complete"
2800+
});
2801+
} else {
2802+
connect_and_start_session(device);
2803+
CFURLRef device_app_url = copy_device_app_url(device, install_bundle_id);
2804+
check_error(AMDeviceStopSession(device));
2805+
check_error(AMDeviceDisconnect(device));
2806+
CFStringRef device_app_path = CFURLCopyFileSystemPath(device_app_url, kCFURLPOSIXPathStyle);
2807+
2808+
NSLogVerbose(@"App path: %@", device_app_path);
2809+
NSLogJSON(@{@"Event": @"BundleInstall",
2810+
@"OverallPercent": @(100),
2811+
@"Percent": @(100),
2812+
@"Status": @"Complete",
2813+
@"Path": (__bridge NSString *)device_app_path
2814+
});
28142815

2815-
CFRelease(device_app_url);
2816-
CFRelease(install_bundle_id);
2817-
CFRelease(device_app_path);
2816+
CFRelease(device_app_url);
2817+
CFRelease(install_bundle_id);
2818+
CFRelease(device_app_path);
2819+
}
28182820
}
28192821
CFRelease(path);
28202822

0 commit comments

Comments
 (0)