├── WORKSPACE ├── src ├── ios-deploy │ ├── version.h │ ├── device_db.h │ ├── MobileDevice.h │ └── errors.h ├── scripts │ ├── .eslintrc.yml │ ├── check_reqs.js │ └── lldb.py └── ios-deploy-tests │ ├── Info.plist │ └── ios_deploy_tests.m ├── .eslintrc ├── demo ├── .gitignore ├── demo.c ├── Entitlements.plist ├── ResourceRules.plist ├── Makefile └── Info.plist ├── increment_version.sh ├── .gitignore ├── .eslintrc.yml ├── .travis.yml ├── .github ├── CONTRIBUTING.md └── ISSUE_TEMPLATE.md ├── RELEASING.md ├── BUILD.bazel ├── package.json ├── LICENSE2 ├── ios-deploy.xcodeproj ├── xcshareddata │ └── xcschemes │ │ └── ios-deploy-tests.xcscheme └── project.pbxproj ├── README.md └── LICENSE /WORKSPACE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ios-deploy/version.h: -------------------------------------------------------------------------------- 1 | "1.12.2" 2 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard" 3 | } 4 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | demo 2 | demo.app 3 | demo.dSYM 4 | /.DS_Store 5 | *~ 6 | -------------------------------------------------------------------------------- /demo/demo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, const char* argv[]) { 4 | int i; 5 | for (i = 0; i < argc; i++) { 6 | printf("argv[%d] = %s\n", i, argv[i]); 7 | } 8 | return 0; 9 | } -------------------------------------------------------------------------------- /increment_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "$1" ] 4 | then 5 | echo "Usage: $0 [version_to_set]" 6 | exit 1 7 | fi 8 | 9 | echo "\"$1\"" > src/ios-deploy/version.h 10 | npm version --no-git-tag-version $1 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | node_modules/* 3 | _Frameworks/* 4 | /.DS_Store 5 | *~ 6 | src/scripts/lldb.pyc 7 | src/ios-deploy/lldb.py.h 8 | package-lock.json 9 | /ios-deploy.xcodeproj/xcuserdata 10 | /ios-deploy.xcodeproj/project.xcworkspace 11 | /bazel-* 12 | -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | root: true 2 | 3 | extends: semistandard 4 | 5 | rules: 6 | indent: 7 | - error 8 | - 4 9 | 10 | no-unused-vars: 11 | - error 12 | - args: after-used 13 | 14 | # excpetions specified in: 15 | # - src/scripts/.eslintrc.yml 16 | -------------------------------------------------------------------------------- /demo/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | get-task-allow 6 | 7 | 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | sudo: false 3 | install: 4 | - npm install 5 | script: 6 | - npm test 7 | notifications: 8 | slack: 9 | secure: ZJtWH/UQ+AdzakirR0gg7EL1SJg2hd+HWJPk/Gn5fibFh05P7qYdFu056fjQyVM2Kbv+39bnv+fg4lxb3OeewSDCSYgbJ7JzYFSwCb/ERwtJgoUJIDZiNzsTodJ4mCFnddgA0DEIFPhK2ntNa71VnKrVbWDJTY4+Kl+GBtmPplk= 10 | -------------------------------------------------------------------------------- /src/scripts/.eslintrc.yml: -------------------------------------------------------------------------------- 1 | rules: 2 | # common src exception: 3 | camelcase: off 4 | 5 | # FUTURE TBD: 6 | no-unused-vars: 7 | - error 8 | - args: none 9 | 10 | # TBD easy fix: 11 | padded-blocks: off 12 | 13 | # FUTURE TBD: 14 | handle-callback-err: off 15 | indent: off 16 | no-multiple-empty-lines: off 17 | no-tabs: off 18 | one-var: off 19 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to ios-deploy 2 | 3 | Github url: 4 | 5 | https://github.com/phonegap/ios-deploy 6 | 7 | Git clone url: 8 | 9 | https://github.com/phonegap/ios-deploy.git 10 | 11 | ## Sending a Pull Request 12 | 13 | Please **create a topic branch** for your issue before submitting your pull request. You will be asked to re-submit if your pull request contains unrelated commits. 14 | 15 | Please elaborate regarding the problem the pull request is supposed to solve, and perhaps also link to any relevant issues the pull request is trying to fix. 16 | -------------------------------------------------------------------------------- /src/scripts/check_reqs.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var util = require('util'); 4 | var child_process = require('child_process'); 5 | 6 | var XCODEBUILD_NOT_FOUND_MESSAGE = 'Please install Xcode from the Mac App Store.'; 7 | var TOOL = 'xcodebuild'; 8 | 9 | var xcode_version = child_process.spawn(TOOL, ['-version']); 10 | 11 | xcode_version.stderr.on('data', function (data) { 12 | console.log('stderr: ' + data); 13 | }); 14 | 15 | xcode_version.on('error', function (err) { 16 | console.log(util.format('Tool %s was not found. %s', TOOL, XCODEBUILD_NOT_FOUND_MESSAGE)); 17 | }); 18 | 19 | -------------------------------------------------------------------------------- /demo/ResourceRules.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | rules 6 | 7 | .* 8 | 9 | Info.plist 10 | 11 | omit 12 | 13 | weight 14 | 10 15 | 16 | ResourceRules.plist 17 | 18 | omit 19 | 20 | weight 21 | 100 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | ## 1. Increment a version 2 | 3 | ``` 4 | export PKG_VER=YOUR_VERSION_HERE 5 | ./increment_version.sh $PKG_VER 6 | git commit -m "Incremented version to $PKG_VER" package.json src/ios-deploy/version.h 7 | ``` 8 | 9 | ## 2. Tag a version 10 | 11 | ``` 12 | git tag $PKG_VER 13 | ``` 14 | 15 | ## 3. Push version and tag 16 | 17 | ``` 18 | git push origin master 19 | git push origin $PKG_VER 20 | ``` 21 | 22 | ## 4. Publish to npm 23 | 24 | ``` 25 | npm publish 26 | ``` 27 | 28 | ## 5. Publish to Homebrew 29 | 30 | ``` 31 | brew bump-formula-pr --url="https://github.com/ios-control/ios-deploy/archive/${PKG_VER}.tar.gz" ios-deploy 32 | ``` 33 | -------------------------------------------------------------------------------- /demo/Makefile: -------------------------------------------------------------------------------- 1 | IOS_CC = clang -ObjC 2 | IOS_SDK = $(shell xcrun --sdk iphoneos --show-sdk-path) 3 | 4 | all: clean demo.app 5 | 6 | demo.app: demo Info.plist 7 | mkdir -p demo.app 8 | cp demo demo.app/ 9 | cp Info.plist ResourceRules.plist demo.app/ 10 | codesign -f -s "iPhone Developer" --entitlements Entitlements.plist demo.app 11 | 12 | demo: demo.c 13 | $(IOS_CC) -g -arch armv7 -isysroot $(IOS_SDK) -framework CoreFoundation -o demo demo.c 14 | 15 | debug: all ios-deploy 16 | @../build/Release/ios-deploy --debug --bundle demo.app 17 | 18 | clean: 19 | @rm -rf *.app demo demo.dSYM 20 | 21 | ios-deploy: 22 | @xcodebuild -project ../ios-deploy.xcodeproj 23 | -------------------------------------------------------------------------------- /demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleName 6 | demo 7 | CFBundleSupportedPlatforms 8 | 9 | iPhoneOS 10 | 11 | CFBundleExecutable 12 | demo 13 | CFBundleVersion 14 | 1.0 15 | CFBundleIdentifier 16 | demo 17 | CFBundleResourceSpecification 18 | ResourceRules.plist 19 | LSRequiresIPhoneOS 20 | 21 | CFBundleDisplayName 22 | demo 23 | 24 | -------------------------------------------------------------------------------- /BUILD.bazel: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "lldb_py_h", 3 | srcs = [":src/scripts/lldb.py"], 4 | outs = ["lldb.py.h"], 5 | cmd = """awk '{ print "\\""$$0"\\\\n\\""}' $< > $@""", 6 | ) 7 | 8 | objc_library( 9 | name = "ios_deploy_lib", 10 | srcs = [ 11 | "src/ios-deploy/MobileDevice.h", 12 | "src/ios-deploy/device_db.h", 13 | "src/ios-deploy/errors.h", 14 | "src/ios-deploy/version.h", 15 | ":lldb_py_h", 16 | ], 17 | non_arc_srcs = ["src/ios-deploy/ios-deploy.m"], 18 | ) 19 | 20 | apple_binary( 21 | name = "ios_deploy", 22 | linkopts = ["-F/Library/Apple/System/Library/PrivateFrameworks"], 23 | platform_type = "macos", 24 | sdk_frameworks = ["MobileDevice"], 25 | visibility = ["//visibility:public"], 26 | deps = [":ios_deploy_lib"], 27 | ) 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## MUST READ BEFORE YOU FILE (DELETE THIS SECTION BEFORE FILING) 2 | 3 | Include the **command line arguments** you used for ios-deploy. 4 | 5 | Don't forget to check out the [README](https://github.com/phonegap/ios-deploy/blob/master/README.md) before filing this issue. 6 | 7 | # Expected behavior 8 | 9 | 10 | # Actual behavior. 11 | 12 | 13 | # Steps to reproduce the problem 14 | 15 | 16 | # System Specs 17 | 18 | Please run the commands below in your Terminal.app and include it in the issue. Check when done and include results below. 19 | 20 | - [ ] 1. system_profiler SPSoftwareDataType 21 | - [ ] 2. ios-deploy -V 22 | - [ ] 3. xcodebuild -version 23 | - [ ] 4. xcode-select --print-path 24 | - [ ] 5. gcc --version 25 | - [ ] 6. lldb --version 26 | - [ ] **If using NodeJS/npm** 27 | - [ ] 7. npm -v 28 | - [ ] 8. node -v 29 | -------------------------------------------------------------------------------- /src/ios-deploy-tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/ios-deploy-tests/ios_deploy_tests.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ios_deploy_tests : XCTestCase 4 | 5 | @end 6 | 7 | @implementation ios_deploy_tests 8 | 9 | - (void)setUp { 10 | [super setUp]; 11 | // Put setup code here. This method is called before the invocation of each test method in the class. 12 | } 13 | 14 | - (void)tearDown { 15 | // Put teardown code here. This method is called after the invocation of each test method in the class. 16 | [super tearDown]; 17 | } 18 | 19 | - (void)testExample { 20 | // This is an example of a functional test case. 21 | // Use XCTAssert and related functions to verify your tests produce the correct results. 22 | } 23 | 24 | - (void)testPerformanceExample { 25 | // This is an example of a performance test case. 26 | [self measureBlock:^{ 27 | // Put the code you want to measure the time of here. 28 | }]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ios-deploy", 3 | "version": "1.12.2", 4 | "os": [ 5 | "darwin" 6 | ], 7 | "description": "launch iOS apps iOS devices from the command line (Xcode 7)", 8 | "main": "ios-deploy", 9 | "bin": "./build/Release/ios-deploy", 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/ios-control/ios-deploy" 13 | }, 14 | "devDependencies": { 15 | "eslint": "~4.19.1", 16 | "eslint-config-semistandard": "^12.0.1", 17 | "eslint-config-standard": "^11.0.0", 18 | "eslint-plugin-import": "^2.12.0", 19 | "eslint-plugin-node": "^6.0.1", 20 | "eslint-plugin-promise": "^3.8.0", 21 | "eslint-plugin-standard": "^3.1.0" 22 | }, 23 | "scripts": { 24 | "preinstall": "./src/scripts/check_reqs.js && xcodebuild", 25 | "build-test": "npm run pycompile && xcodebuild test -scheme ios-deploy-tests", 26 | "eslint": "eslint src/scripts/*.js", 27 | "test": "npm run eslint && npm run build-test", 28 | "pycompile": "python -m py_compile src/scripts/*.py", 29 | "postversion": "echo \\\"$npm_package_version\\\" > src/ios-deploy/version.h" 30 | }, 31 | "files": [ 32 | "demo", 33 | "src", 34 | "ios-deploy.xcodeproj/project.pbxproj", 35 | "ios-deploy.xcodeproj/xcshareddata" 36 | ], 37 | "keywords": [ 38 | "ios-deploy", 39 | "deploy to iOS device" 40 | ], 41 | "bugs": { 42 | "url": "https://github.com/phonegap/ios-deploy/issues" 43 | }, 44 | "author": "Greg Hughes", 45 | "license": "GPLv3" 46 | } 47 | -------------------------------------------------------------------------------- /LICENSE2: -------------------------------------------------------------------------------- 1 | Parts of error code to localization id map is taken from SDMMobileDevice framework. Associated license is bellow. 2 | https://github.com/samdmarshall/SDMMobileDevice/blob/c3e1e97b1310c7a7a10f68281752760038b75e16/Framework/include/SDMMobileDevice/SDMMD_Error.h 3 | 4 | Copyright (c) 2014, Sam Marshall 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 8 | following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer 13 | in the documentation and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of Sam Marshall nor the names of its contributors may be used to endorse or promote products derived from this 16 | software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /ios-deploy.xcodeproj/xcshareddata/xcschemes/ios-deploy-tests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | 41 | 42 | 48 | 49 | 51 | 52 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/scripts/lldb.py: -------------------------------------------------------------------------------- 1 | import time 2 | import os 3 | import sys 4 | import shlex 5 | import lldb 6 | 7 | listener = None 8 | startup_error = lldb.SBError() 9 | 10 | def connect_command(debugger, command, result, internal_dict): 11 | # These two are passed in by the script which loads us 12 | connect_url = internal_dict['fruitstrap_connect_url'] 13 | error = lldb.SBError() 14 | 15 | # We create a new listener here and will use it for both target and the process. 16 | # It allows us to prevent data races when both our code and internal lldb code 17 | # try to process STDOUT/STDERR messages 18 | global listener 19 | listener = lldb.SBListener('iosdeploy_listener') 20 | 21 | listener.StartListeningForEventClass(debugger, 22 | lldb.SBProcess.GetBroadcasterClassName(), 23 | lldb.SBProcess.eBroadcastBitStateChanged | lldb.SBProcess.eBroadcastBitSTDOUT | lldb.SBProcess.eBroadcastBitSTDERR) 24 | 25 | process = debugger.GetSelectedTarget().ConnectRemote(listener, connect_url, None, error) 26 | 27 | # Wait for connection to succeed 28 | events = [] 29 | state = (process.GetState() or lldb.eStateInvalid) 30 | 31 | while state != lldb.eStateConnected: 32 | event = lldb.SBEvent() 33 | if listener.WaitForEvent(1, event): 34 | state = process.GetStateFromEvent(event) 35 | events.append(event) 36 | else: 37 | state = lldb.eStateInvalid 38 | 39 | # Add events back to queue, otherwise lldb freezes 40 | for event in events: 41 | listener.AddEvent(event) 42 | 43 | def run_command(debugger, command, result, internal_dict): 44 | device_app = internal_dict['fruitstrap_device_app'] 45 | args = command.split('--',1) 46 | debugger.GetSelectedTarget().modules[0].SetPlatformFileSpec(lldb.SBFileSpec(device_app)) 47 | args_arr = [] 48 | if len(args) > 1: 49 | args_arr = shlex.split(args[1]) 50 | args_arr = args_arr + shlex.split('{args}') 51 | 52 | launchInfo = lldb.SBLaunchInfo(args_arr) 53 | global listener 54 | launchInfo.SetListener(listener) 55 | 56 | #This env variable makes NSLog, CFLog and os_log messages get mirrored to stderr 57 | #https://stackoverflow.com/a/39581193 58 | launchInfo.SetEnvironmentEntries(['OS_ACTIVITY_DT_MODE=enable'], True) 59 | 60 | envs_arr = [] 61 | if len(args) > 1: 62 | envs_arr = shlex.split(args[1]) 63 | envs_arr = envs_arr + shlex.split('{envs}') 64 | launchInfo.SetEnvironmentEntries(envs_arr, True) 65 | 66 | debugger.GetSelectedTarget().Launch(launchInfo, startup_error) 67 | lockedstr = ': Locked' 68 | if lockedstr in str(startup_error): 69 | print('\\nDevice Locked\\n') 70 | os._exit(254) 71 | else: 72 | print(str(startup_error)) 73 | 74 | def safequit_command(debugger, command, result, internal_dict): 75 | process = debugger.GetSelectedTarget().process 76 | state = process.GetState() 77 | if state == lldb.eStateRunning: 78 | process.Detach() 79 | os._exit(0) 80 | elif state > lldb.eStateRunning: 81 | os._exit(state) 82 | else: 83 | print('\\nApplication has not been launched\\n') 84 | os._exit(1) 85 | 86 | 87 | def print_stacktrace(thread): 88 | # Somewhere between Xcode-13.2.1 and Xcode-13.3 lldb starts to throw an error during printing of backtrace. 89 | # Manually write the backtrace out so we don't just get 'invalid thread'. 90 | sys.stdout.write(' ' + str(thread) + '\\n') 91 | for frame in thread: 92 | out = lldb.SBStream() 93 | frame.GetDescription(out) 94 | sys.stdout.write(' ' * 4 + out.GetData()) 95 | 96 | def autoexit_command(debugger, command, result, internal_dict): 97 | global listener 98 | process = debugger.GetSelectedTarget().process 99 | if not startup_error.Success(): 100 | print('\\nPROCESS_NOT_STARTED\\n') 101 | os._exit({exitcode_app_crash}) 102 | 103 | output_path = internal_dict['fruitstrap_output_path'] 104 | out = None 105 | if output_path: 106 | out = open(output_path, 'w') 107 | 108 | error_path = internal_dict['fruitstrap_error_path'] 109 | err = None 110 | if error_path: 111 | err = open(error_path, 'w') 112 | 113 | detectDeadlockTimeout = {detect_deadlock_timeout} 114 | printBacktraceTime = time.time() + detectDeadlockTimeout if detectDeadlockTimeout > 0 else None 115 | 116 | # This line prevents internal lldb listener from processing STDOUT/STDERR/StateChanged messages. 117 | # Without it, an order of log writes is incorrect sometimes 118 | debugger.GetListener().StopListeningForEvents(process.GetBroadcaster(), 119 | lldb.SBProcess.eBroadcastBitSTDOUT | lldb.SBProcess.eBroadcastBitSTDERR | lldb.SBProcess.eBroadcastBitStateChanged ) 120 | 121 | event = lldb.SBEvent() 122 | 123 | def ProcessSTDOUT(): 124 | stdout = process.GetSTDOUT(1024) 125 | while stdout: 126 | if out: 127 | out.write(stdout) 128 | else: 129 | sys.stdout.write(stdout) 130 | stdout = process.GetSTDOUT(1024) 131 | 132 | def ProcessSTDERR(): 133 | stderr = process.GetSTDERR(1024) 134 | while stderr: 135 | if err: 136 | err.write(stderr) 137 | else: 138 | sys.stdout.write(stderr) 139 | stderr = process.GetSTDERR(1024) 140 | 141 | def CloseOut(): 142 | sys.stdout.flush() 143 | if (out): 144 | out.close() 145 | if (err): 146 | err.close() 147 | 148 | while True: 149 | if listener.WaitForEvent(1, event) and lldb.SBProcess.EventIsProcessEvent(event): 150 | state = lldb.SBProcess.GetStateFromEvent(event) 151 | type = event.GetType() 152 | 153 | if type & lldb.SBProcess.eBroadcastBitSTDOUT: 154 | ProcessSTDOUT() 155 | 156 | if type & lldb.SBProcess.eBroadcastBitSTDERR: 157 | ProcessSTDERR() 158 | 159 | else: 160 | state = process.GetState() 161 | 162 | if state != lldb.eStateRunning: 163 | # Let's make sure that we drained our streams before exit 164 | ProcessSTDOUT() 165 | ProcessSTDERR() 166 | 167 | if state == lldb.eStateExited: 168 | sys.stdout.write( '\\nPROCESS_EXITED\\n' ) 169 | CloseOut() 170 | os._exit(process.GetExitStatus()) 171 | elif printBacktraceTime is None and state == lldb.eStateStopped: 172 | haveException = False 173 | allThreads = process.get_process_thread_list() 174 | for thread in allThreads: 175 | if(thread.GetStopReason() == lldb.eStopReasonException): 176 | haveException = True 177 | print_stacktrace(thread) 178 | if haveException == False: 179 | selectedThread = process.GetSelectedThread() 180 | if selectedThread.GetStopReason() == lldb.eStopReasonNone: 181 | # During startup there are some stops for lldb to setup properly. 182 | # On iOS-16 we receive them with stop reason none. 183 | continue 184 | else: 185 | print_stacktrace(selectedThread) 186 | sys.stdout.write( '\\nPROCESS_STOPPED\\n' ) 187 | CloseOut() 188 | os._exit({exitcode_app_crash}) 189 | elif state == lldb.eStateCrashed: 190 | sys.stdout.write( '\\nPROCESS_CRASHED\\n' ) 191 | print_stacktrace(process.GetSelectedThread()) 192 | CloseOut() 193 | os._exit({exitcode_app_crash}) 194 | elif state == lldb.eStateDetached: 195 | sys.stdout.write( '\\nPROCESS_DETACHED\\n' ) 196 | CloseOut() 197 | os._exit({exitcode_app_crash}) 198 | elif printBacktraceTime is not None and time.time() >= printBacktraceTime: 199 | printBacktraceTime = None 200 | sys.stdout.write( '\\nPRINT_BACKTRACE_TIMEOUT\\n' ) 201 | debugger.HandleCommand('process interrupt') 202 | for thread in process: 203 | print_stacktrace(thread) 204 | sys.stdout.write('\\n') 205 | debugger.HandleCommand('continue') 206 | printBacktraceTime = time.time() + 5 207 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/ios-control/ios-deploy.svg?branch=master)](https://travis-ci.org/ios-control/ios-deploy) 2 | 3 | ios-deploy 4 | ========== 5 | 6 | Install and debug iOS apps from the command line. Designed to work on un-jailbroken devices running iOS versions prior to iOS17. [iOS17 updated the System frameworks used to communicate with devices and Apple created their own command-line tools that can largely replace ios-deploy](https://github.com/ios-control/ios-deploy/issues/588). 7 | 8 | ## Requirements 9 | 10 | * macOS 11 | * You need to have a valid iOS Development certificate installed 12 | * Xcode (**NOT** just Command Line Tools!) 13 | 14 | #### Tested Configurations 15 | The ios-deploy binary in Homebrew should work on macOS 10.0+ with Xcode7+. It has been most recently tested with the following configurations: 16 | - macOS 10.14 Mojave, 10.15 Catalina and preliminary testing on 11.0b BigSur 17 | - iOS 13.0 and preliminary testing on iOS 14.0b 18 | - Xcode 11.3, 11.6 and preliminary testing on Xcode 12 betas 19 | - x86 and preliminary testing on Arm64e based Apple Macintosh Computers 20 | 21 | ## Roadmap 22 | 23 | See our [milestones](https://github.com/phonegap/ios-deploy/milestones). 24 | 25 | ## Development 26 | 27 | The 1.x branch has been archived (renamed for now), all development is to be on the master branch for simplicity, since the planned 2.x development (break out commands into their own files) has been abandoned for now. 28 | 29 | ## Installation 30 | 31 | If you have previously installed ios-deploy via `npm`, uninstall it by running: 32 | ``` 33 | sudo npm uninstall -g ios-deploy 34 | ``` 35 | 36 | Install ios-deploy via [Homebrew](https://brew.sh/) by running: 37 | 38 | ``` 39 | brew install ios-deploy 40 | ``` 41 | 42 | ## Testing 43 | 44 | Run: 45 | 46 | ``` 47 | python -m py_compile src/scripts/*.py && xcodebuild -target ios-deploy && xcodebuild test -scheme ios-deploy-tests 48 | ``` 49 | 50 | ## Usage 51 | 52 | Usage: ios-deploy [OPTION]... 53 | -d, --debug launch the app in lldb after installation 54 | -i, --id the id of the device to connect to 55 | -c, --detect list all connected devices 56 | -b, --bundle the path to the app bundle to be installed 57 | -a, --args command line arguments to pass to the app when launching it 58 | -s, --envs environment variables, space separated key-value pairs, to pass to the app when launching it 59 | -t, --timeout number of seconds to wait for a device to be connected 60 | -u, --unbuffered don't buffer stdout 61 | -n, --nostart do not start the app when debugging 62 | -N, --nolldb start debugserver only. do not run lldb. Can not be used with args or envs options 63 | -I, --noninteractive start in non interactive mode (quit when app crashes or exits) 64 | -L, --justlaunch just launch the app and exit lldb 65 | -v, --verbose enable verbose output 66 | -m, --noinstall directly start debugging without app install (-d not required) 67 | -A, --app_deltas incremental install. must specify a directory to store app deltas to determine what needs to be installed 68 | -p, --port port used for device, default: dynamic 69 | -r, --uninstall uninstall the app before install (do not use with -m; app cache and data are cleared) 70 | -9, --uninstall_only uninstall the app ONLY. Use only with -1 71 | -1, --bundle_id specify bundle id for list and upload 72 | -l, --list[=] list all app files or the specified directory 73 | -o, --upload upload file 74 | -w, --download[=] download app tree or the specified file/directory 75 | -2, --to use together with up/download file/tree. specify target 76 | -D, --mkdir make directory on device 77 | -R, --rm remove file or directory on device (directories must be empty) 78 | -X, --rmtree remove directory and all contained files recursively on device 79 | -V, --version print the executable version 80 | -e, --exists check if the app with given bundle_id is installed or not 81 | -B, --list_bundle_id list bundle_id 82 | -W, --no-wifi ignore wifi devices 83 | -C, --get_battery_level get battery current capacity 84 | -O, --output write stdout to this file 85 | -E, --error_output write stderr to this file 86 | --detect_deadlocks start printing backtraces for all threads periodically after specific amount of seconds 87 | -f, --file_system specify file system for mkdir / list / upload / download / rm 88 | -F, --non-recursively specify non-recursively walk directory 89 | -S, --symbols download OS symbols. must specify a directory to store the downloaded symbols 90 | -j, --json format output as JSON 91 | -k, --key keys for the properties of the bundle. Joined by ',' and used only with -B and -j 92 | --custom-script