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

Add -k/--key option. Allow getting more properties of the app #497

Merged
merged 27 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
64a25e6
Fix the error when try to access some apps' sandbox by using a differ…
Jan 19, 2020
0c95037
Merge branch 'master' into master
gabebear Jan 19, 2020
d714a93
Merge pull request #1 from ios-control/master
ryanluoo Jan 21, 2020
d333196
Merge pull request #2 from ios-control/master
ryanluoo Mar 27, 2020
a3f327a
Add --file_system option that can support file system access
Mar 27, 2020
c55fa29
Add -F/--non-recursively option that controls whether to walk the dir…
Mar 29, 2020
63fb418
Merge branch 'master' into master
ryanluoo Mar 29, 2020
2befa16
format the code
Mar 30, 2020
c919eef
Merge branch 'master' of github.com:ryanluoo/ios-deploy-origin
Mar 30, 2020
db115ea
fix: gate the call to read_dir() rather than return early inside lis…
Apr 1, 2020
fdce430
fix: add missing long option for -F/--non-recursively
Apr 1, 2020
833a9c7
fix remove extra space
Apr 1, 2020
fe0a5d8
Merge branch 'master' into master
ryanluoo Apr 1, 2020
d7e5a9c
Merge pull request #4 from ios-control/master
ryanluoo Apr 1, 2020
c688b8b
add product_version and build_version in device's full name
Apr 2, 2020
bf65d4d
Merge branch 'master' of github.com:ryanluoo/ios-deploy-origin
Apr 2, 2020
a3a4b35
Revert "add product_version and build_version in device's full name"
Apr 2, 2020
78e68bf
add --json support for list_bundle_id
Apr 3, 2020
a43b879
only get result's keys when --json is not set
Apr 5, 2020
191ae03
Merge pull request #5 from ios-control/master
ryanluoo Oct 14, 2020
8c87089
Merge pull request #6 from ios-control/master
ryanluoo Oct 21, 2020
f935598
Merge pull request #7 from ios-control/master
ryanluoo Jan 21, 2021
eca2364
Add -k/--key option. Allow getting more properties of the app
Jan 21, 2021
39e5bef
Update the usage info & Revise the error message
Jan 22, 2021
e3bba0c
Remove redundant char
Jan 22, 2021
c5ee713
Update README with the new option -k/--key
Jan 24, 2021
751e77e
Update README.md. Replace the space with tab
ryanluoo Jan 24, 2021
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ python -m py_compile src/scripts/*.py && xcodebuild -target ios-deploy && xcodeb
-E, --error_output <file> write stderr to this file
--detect_deadlocks <sec> start printing backtraces for all threads periodically after specific amount of seconds
-f, --file_system specify file system for mkdir / list / upload / download / rm
-k, --key keys for the properties of the bundle. Joined by '&' and used only with -B <list_bundle_id> and -j <json>
-F, --non-recursively specify non-recursively walk directory
-j, --json format output as JSON

Expand Down Expand Up @@ -151,6 +152,10 @@ The commands below assume that you have an app called `my.app` with bundle id `b

// upload file to /DCIM
ios-deploy -f -o/Users/ryan/Downloads/test.png -2/DCIM/test.png

// get more properties of the bundle
ios-deploy -B -j --key=UIFileSharingEnabled&CFBundlePackageType


## Demo

Expand Down
27 changes: 18 additions & 9 deletions src/ios-deploy/ios-deploy.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
char const*target_filename = NULL;
char const*upload_pathname = NULL;
char *bundle_id = NULL;
char *key = NULL;
bool interactive = true;
bool justlaunch = false;
bool file_system = false;
Expand Down Expand Up @@ -1706,13 +1707,16 @@ void get_battery_level(AMDeviceRef device)
void list_bundle_id(AMDeviceRef device)
{
connect_and_start_session(device);

NSArray *a = [NSArray arrayWithObjects:
@"CFBundleIdentifier",
@"CFBundleName",
@"CFBundleDisplayName",
@"CFBundleVersion",
@"CFBundleShortVersionString", nil];
NSMutableArray *a = [NSMutableArray arrayWithObjects:
@"CFBundleIdentifier",
@"CFBundleName",
@"CFBundleDisplayName",
@"CFBundleVersion",
@"CFBundleShortVersionString", nil];
if (key) {
NSArray * ns_keys = [[NSString stringWithUTF8String:key] componentsSeparatedByString:@"&"];
[a addObjectsFromArray:ns_keys];
}
NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"];
CFDictionaryRef options = (CFDictionaryRef)optionsDict;
CFDictionaryRef result = nil;
Expand Down Expand Up @@ -2279,6 +2283,7 @@ void usage(const char* app) {
@" -f, --file_system specify file system for mkdir / list / upload / download / rm\n"
@" -F, --non-recursively specify non-recursively walk directory\n"
@" -j, --json format output as JSON\n"
@" -k, --key keys for the properties of the bundle. Joined by '&' and used only with -B <list_bundle_id> and -j <json> \n"
@" --custom-script <script> path to custom python script to execute in lldb\n"
@" --custom-command <command> specify additional lldb commands to execute\n",
[NSString stringWithUTF8String:app]);
Expand Down Expand Up @@ -2336,13 +2341,14 @@ int main(int argc, char *argv[]) {
{ "app_deltas", required_argument, NULL, 'A'},
{ "file_system", no_argument, NULL, 'f'},
{ "non-recursively", no_argument, NULL, 'F'},
{ "key", optional_argument, NULL, 'k' },
{ "custom-script", required_argument, NULL, 1001},
{ "custom-command", required_argument, NULL, 1002},
{ NULL, 0, NULL, 0 },
};
int ch;

while ((ch = getopt_long(argc, argv, "VmcdvunrILefFD:R:X:i:b:a:t:p:1:2:o:l:w:9BWjNs:OE:CA:", longopts, NULL)) != -1)
while ((ch = getopt_long(argc, argv, "VmcdvunrILefFD:R:X:i:b:a:t:p:1:2:o:l:w:9BWjNs:OE:CA:k:", longopts, NULL)) != -1)
{
switch (ch) {
case 'm':
Expand Down Expand Up @@ -2488,6 +2494,9 @@ int main(int argc, char *argv[]) {
}
[custom_commands appendFormat:@"%s\n", optarg];
break;
case 'k':
key = optarg;
break;
default:
usage(argv[0]);
return exitcode_error;
Expand All @@ -2501,7 +2510,7 @@ int main(int argc, char *argv[]) {

if (!app_path && !detect_only && !command_only) {
usage(argv[0]);
on_error(@"One of -[b|c|o|l|w|D|R|e|9] is required to proceed!");
on_error(@"One of -[b|c|o|l|w|D|R|X|e|B|C|9] is required to proceed!");
}

if (unbuffered) {
Expand Down