Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print the installation path of the app bundle on the actual device af… #503

Merged
merged 2 commits into from
Feb 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions src/ios-deploy/ios-deploy.m
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,17 @@ void handle_device(AMDeviceRef device) {
NSLogOut(@"------ Install phase ------");
NSLogOut(@"[ 0%%] Found %@ connected through %@, beginning install", device_full_name, device_interface_name);

CFStringRef install_bundle_id = NULL;
if (bundle_id != NULL) {
install_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
} else {
CFStringRef extracted_bundle_id = copy_bundle_id(url);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this need a CFRelease()?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NVM, see below it will be released... have you run the analyzer on this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep did run analyzer, no new issues reported.

if (extracted_bundle_id == NULL) {
on_error(@"[ ERROR] Could not determine bundle id.");
}
install_bundle_id = extracted_bundle_id;
}

CFDictionaryRef options;
if (app_deltas == NULL) { // standard install
CFStringRef keys[] = { CFSTR("PackageType") };
Expand All @@ -2157,18 +2168,6 @@ void handle_device(AMDeviceRef device) {
check_error(AMDeviceStopSession(device));
check_error(AMDeviceDisconnect(device));
} else { // incremental install
CFStringRef extracted_bundle_id = NULL;
CFStringRef extracted_bundle_id_ref = copy_bundle_id(url);
if (bundle_id != NULL) {
extracted_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
CFRelease(extracted_bundle_id_ref);
} else {
if (extracted_bundle_id_ref == NULL) {
on_error(@"[ ERROR] Could not determine bundle id.");
}
extracted_bundle_id = extracted_bundle_id_ref;
}

CFStringRef deltas_path =
CFStringCreateWithCString(NULL, app_deltas, kCFStringEncodingUTF8);
CFURLRef deltas_relative_url =
Expand All @@ -2187,7 +2186,7 @@ void handle_device(AMDeviceRef device) {
CFSTR("ShadowParentKey"),
};
CFStringRef values[] = {
extracted_bundle_id,
install_bundle_id,
CFSTR("1"),
CFSTR("1"),
CFSTR("1"),
Expand All @@ -2201,7 +2200,6 @@ void handle_device(AMDeviceRef device) {

// Incremental installs should be done without a session started because of timeouts.
check_error(AMDeviceSecureInstallApplicationBundle(device, url, options, incremental_install_callback, 0));
CFRelease(extracted_bundle_id);
CFRelease(deltas_path);
CFRelease(deltas_relative_url);
CFRelease(app_deltas_url);
Expand All @@ -2211,12 +2209,24 @@ void handle_device(AMDeviceRef device) {

CFRelease(options);

connect_and_start_session(device);
CFURLRef device_app_url = copy_device_app_url(device, install_bundle_id);
check_error(AMDeviceStopSession(device));
check_error(AMDeviceDisconnect(device));
CFStringRef device_app_path = CFURLCopyFileSystemPath(device_app_url, kCFURLPOSIXPathStyle);

NSLogOut(@"[100%%] Installed package %@", [NSString stringWithUTF8String:app_path]);
NSLogVerbose(@"App path: %@", device_app_path);
NSLogJSON(@{@"Event": @"BundleInstall",
@"OverallPercent": @(100),
@"Percent": @(100),
@"Status": @"Complete"
@"Status": @"Complete",
@"Path": (__bridge NSString *)device_app_path
});

CFRelease(device_app_url);
CFRelease(install_bundle_id);
CFRelease(device_app_path);
}
CFRelease(path);

Expand Down