46 Commits
1.7.0 ... 1.8.0

Author SHA1 Message Date
Shazron Abdullah
9f6b41519b Merge branch '135-xcode-project' 2015-10-06 23:10:10 -07:00
Shazron Abdullah
5d2166fcef Fixes #135 - Convert Makefile to xcodeproject. Demo in its own folder now with its own Makefile. 2015-10-06 23:06:45 -07:00
Shazron Abdullah
6ce22c2adc Fixes #176 - Add documentation issue for node preinstall script (workaround) 2015-10-06 22:48:33 -07:00
Shazron Abdullah
ede5d2542d Fixes #156 - --list command add trailing slash for directories 2015-10-06 22:48:33 -07:00
Shazron Abdullah
6b7b31d54a check_reqs - removed shelljs dependency 2015-10-06 22:48:33 -07:00
Shazron Abdullah
8d60757e77 Fixes #167 - On El Cap, detect Xcode 7 properly installed 2015-10-06 22:48:33 -07:00
Shazron Abdullah
2f9fb4304a Incremented version to 1.8.0 2015-10-06 22:48:33 -07:00
Shazron Abdullah
a6e94923cf Fixes #170 - ios-deploy installing over both USB and WiFi 2015-10-06 22:48:32 -07:00
Shazron Abdullah
342965c16a Added iPhone 6s and 6s Plus models. 2015-10-06 22:48:32 -07:00
Shazron Abdullah
4ce3554561 Fixes #164 - Error when launch application in multi-user context 2015-10-06 22:48:32 -07:00
Shazron Abdullah
ab39342b0f Fixes #166 - Segfault when passed a non-existent bundle #166 2015-10-06 22:48:32 -07:00
Shazron Abdullah
2a1844500b Fixes #168 - Segmentation Fault 11 (when deploying an .ipa file) 2015-10-06 22:48:32 -07:00
Shazron Abdullah
5e7420502b Fixes #56 - Assertion failed AMDeviceSecureTransferPath (app name has non-ASCII characters) 2015-10-06 22:48:31 -07:00
Shazron Abdullah
545521954b Fixed typo in README example. 2015-10-06 22:48:31 -07:00
Shazron Abdullah
d6216760e4 Fixes #153 - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString' #153 2015-10-06 22:48:31 -07:00
Julius Trinkunas
0390522194 Add text for errors 0xe8008016 and 0xe8008017. 2015-10-06 22:48:31 -07:00
Julius Trinkunas
ca2e7a3c75 Add attribution for error code reverse engineering. Second try. 2015-10-06 22:48:31 -07:00
Julius Trinkunas
ed7c70aa59 Add attribution for error code reverse engineering. 2015-10-06 22:48:31 -07:00
Julius Trinkunas
093b4b3c9a Add text for error 0xe8008018. 2015-10-06 22:48:30 -07:00
Julius Trinkunas
4d58838ef1 Add text for 0xe800801c error. 2015-10-06 22:48:30 -07:00
Julius Trinkunas
d10562c501 Add text for 0xe8008019 error. 2015-10-06 22:48:30 -07:00
Julius Trinkunas
99dba4e58c Fixes #157 - Bad error formatting string in check_error() 2015-10-06 22:48:30 -07:00
Shazron Abdullah
bf58b61561 Fixes #176 - Add documentation issue for node preinstall script (workaround) 2015-10-06 22:13:04 -07:00
Shazron Abdullah
d2aee71a92 Fixes #156 - --list command add trailing slash for directories 2015-10-06 22:06:28 -07:00
Shazron Abdullah
92f6238bba check_reqs - removed shelljs dependency 2015-10-06 22:01:36 -07:00
Shazron Abdullah
6aa7b57014 Fixes #167 - On El Cap, detect Xcode 7 properly installed 2015-10-06 17:46:50 -07:00
Shazron Abdullah
55d076b805 Incremented version to 1.8.0 2015-10-06 17:11:14 -07:00
Shazron Abdullah
3756385651 Fixes #170 - ios-deploy installing over both USB and WiFi 2015-10-06 16:51:27 -07:00
Shazron Abdullah
adc8a5b9c2 Added iPhone 6s and 6s Plus models. 2015-10-06 15:47:59 -07:00
Shazron Abdullah
bb25caf586 Fixes #164 - Error when launch application in multi-user context 2015-10-06 15:39:57 -07:00
Shazron Abdullah
75820a0979 Fixes #166 - Segfault when passed a non-existent bundle #166 2015-10-06 14:00:42 -07:00
Shazron Abdullah
16f52589db Fixes #168 - Segmentation Fault 11 (when deploying an .ipa file) 2015-10-06 13:43:28 -07:00
Shazron Abdullah
21c8dc9cf5 Fixes #56 - Assertion failed AMDeviceSecureTransferPath (app name has non-ASCII characters) 2015-10-06 13:33:51 -07:00
Shazron Abdullah
34540ce545 Fixed typo in README example. 2015-10-06 13:18:50 -07:00
Shazron Abdullah
7b834b0e31 Fixes #153 - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString' #153 2015-10-06 13:14:21 -07:00
Shazron Abdullah
7ac9cdb107 Merge pull request #172 from Unity-Technologies/error-messages
Add text for errors 0xe8008016 and 0xe8008017.
2015-09-15 10:07:24 -07:00
Julius Trinkunas
cf9d024a2b Add text for errors 0xe8008016 and 0xe8008017. 2015-09-15 18:14:37 +03:00
Shazron Abdullah
4d4735e505 Merge pull request #159 from Unity-Technologies/error-messages
Error messages
2015-08-15 10:21:34 +08:00
Julius Trinkunas
2c9ea8f16e Add attribution for error code reverse engineering. Second try. 2015-08-11 13:28:04 +03:00
Julius Trinkunas
5eb12202b2 Add attribution for error code reverse engineering. 2015-08-10 16:01:13 +03:00
Julius Trinkunas
307a5f9452 Add text for error 0xe8008018. 2015-07-28 13:00:15 +03:00
Julius Trinkunas
835e161f66 Add text for 0xe800801c error. 2015-07-22 18:33:51 +03:00
Julius Trinkunas
73f30fdfed Add text for 0xe8008019 error. 2015-07-22 18:19:02 +03:00
Julius Trinkunas
be506a9f7f Fixes #157 - Bad error formatting string in check_error() 2015-07-22 18:16:31 +03:00
Shazron Abdullah
bc1bb0d320 Fixes #135 - convert Makefile to Xcode project 2015-07-16 17:26:48 -07:00
Shazron Abdullah
7d997b89c7 Removed buildbox shell script 2015-07-16 16:57:24 -07:00
17 changed files with 504 additions and 125 deletions

5
.gitignore vendored
View File

@@ -1,6 +1,3 @@
demo
demo.app
ios-deploy
ios-deploy.dSYM
build/*
/.DS_Store
*~

View File

@@ -1,2 +1,8 @@
ios-deploy is available under the provisions of the GNU General Public License,
version 3 (or later), available here: http://www.gnu.org/licenses/gpl-3.0.html
Error codes used for error messages were taken from SDMMobileDevice framework,
originally reverse engineered by Sam Marshall. SDMMobileDevice is distributed
under BSD 3-Clause license and is available here:
https://github.com/samdmarshall/SDMMobileDevice

View File

@@ -1,35 +0,0 @@
IOS_SDK_VERSION = 8.3
IOS_CC = gcc -ObjC
DEVICE_SUPPORT = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/DeviceSupport
IOS_SDK = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(IOS_SDK_VERSION).sdk
all: clean ios-deploy demo.app
demo.app: demo Info.plist
mkdir -p demo.app
cp demo demo.app/
cp Info.plist ResourceRules.plist demo.app/
codesign -f -s "iPhone Developer" --entitlements Entitlements.plist demo.app
demo: demo.c
$(IOS_CC) -g -arch armv7 -isysroot $(IOS_SDK) -framework CoreFoundation -o demo demo.c
ios-deploy: clean ios-deploy.c
$(IOS_CC) -g -o ios-deploy -framework Foundation -framework CoreFoundation -framework MobileDevice -F/System/Library/PrivateFrameworks ios-deploy.c
symlink:
cd $(DEVICE_SUPPORT); ln -sfn "`find . -type d -maxdepth 1 -exec basename {} \; | tail -1`" Latest
install: symlink ios-deploy
mkdir -p $(prefix)/bin
cp ios-deploy $(prefix)/bin
uninstall:
rm $(prefix)/bin/ios-deploy
debug: all
./ios-deploy --debug --bundle demo.app
clean:
@rm -rf *.app demo ios-deploy

View File

@@ -4,9 +4,9 @@ Install and debug iOS apps without using Xcode. Designed to work on un-jailbroke
## Requirements
* Mac OS X. Tested on 10.10 Yosemite and iOS 8.3
* Mac OS X. Tested on 10.11 El Capitan and iOS 9.0
* You need to have a valid iOS Development certificate installed.
* Xcode 6 or greater should be installed
* Xcode 6.4 or greater should be installed
## Roadmap
@@ -40,6 +40,14 @@ make install prefix=/usr/local
This will install ios-deploy in the `bin` folder of `/usr/local`, i.e. `/usr/local/bin`
### OS X 10.11 El Capitan
If you are *not* using a node version manager like [nvm](https://github.com/creationix/nvm) or [n](https://github.com/tj/n), you may have to do either of these two things below when under El Capitan:
1. Add the `--unsafe-perm` flag when installing ios-deploy
2. Ensure the `nobody` user has write access to `/usr/local/lib/node_modules/ios-deploy/ios-deploy`
## Usage
Usage: ios-deploy [OPTION]...
@@ -98,7 +106,7 @@ The commands below assume that you have an app called `my.app` with bundle id `b
ios-deploy --exists --bundle_id com.apple.mobilemail
// Download the Documents directory of the app *only*
ios-deploy --download=/Documents -bundle_id my.app.id --to ./my_download_location
ios-deploy --download=/Documents --bundle_id my.app.id --to ./my_download_location
// List ids and names of connected devices
ios-deploy -c
@@ -113,7 +121,7 @@ The commands below assume that you have an app called `my.app` with bundle id `b
The included demo.app represents the minimum required to get code running on iOS.
* `make demo.app` will generate the demo.app executable. If it doesn't compile, modify IOS_SDK_VERSION in the Makefile.
* `make demo.app` will generate the demo.app executable. If it doesn't compile, modify `IOS_SDK_VERSION` in the Makefile.
* `make debug` will install demo.app and launch a LLDB session.
## Notes

45
check_reqs.js Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env node
var util = require('util');
var os = require('os');
var child_process = require('child_process');
var XCODEBUILD_MIN_VERSION = '6.4';
var XCODEBUILD_NOT_FOUND_MESSAGE = util.format('Please install Xcode version %s or greater from the Mac App Store.', XCODEBUILD_MIN_VERSION);
var TOOL = 'xcodebuild';
var xcode_version = child_process.spawn(TOOL, ['-version']),
version_string = '';
xcode_version.stdout.on('data', function (data) {
version_string += data;
});
xcode_version.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
xcode_version.on('error', function (err) {
console.log(util.format('Tool %s was not found. %s', TOOL, XCODEBUILD_NOT_FOUND_MESSAGE));
});
xcode_version.on('close', function (code) {
if (code === 0) {
var arr = version_string.match(/^Xcode (\d+\.\d+)/);
var ver = arr[1];
if (os.release() >= '15.0.0' && ver < '7.0') {
console.log(util.format('You need at least Xcode 7.0 when you are on OS X 10.11 El Capitan (you have version %s)', ver));
process.exit(1);
}
if (ver < XCODEBUILD_MIN_VERSION) {
console.log(util.format('%s : %s. (you have version %s)', tool, XCODEBUILD_NOT_FOUND_MESSAGE, ver));
}
}
process.exit(code);
});

5
demo/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
demo
demo.app
demo.dSYM
/.DS_Store
*~

24
demo/Makefile Normal file
View File

@@ -0,0 +1,24 @@
IOS_SDK_VERSION = 9.0
IOS_CC = gcc -ObjC
IOS_SDK = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(IOS_SDK_VERSION).sdk
all: clean demo.app
demo.app: demo Info.plist
mkdir -p demo.app
cp demo demo.app/
cp Info.plist ResourceRules.plist demo.app/
codesign -f -s "iPhone Developer" --entitlements Entitlements.plist demo.app
demo: demo.c
$(IOS_CC) -g -arch armv7 -isysroot $(IOS_SDK) -framework CoreFoundation -o demo demo.c
debug: all ios-deploy
@../build/Release/ios-deploy --debug --bundle demo.app
clean:
@rm -rf *.app demo demo.dSYM
ios-deploy:
@xcodebuild -project ../ios-deploy.xcodeproj

View File

@@ -6,4 +6,4 @@ int main(int argc, const char* argv[]) {
printf("argv[%d] = %s\n", i, argv[i]);
}
return 0;
}
}

View File

@@ -0,0 +1,275 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
7E70899C1B587DE4004D23AA /* ios-deploy.c in Sources */ = {isa = PBXBuildFile; fileRef = 7E7089991B587DE4004D23AA /* ios-deploy.c */; settings = {COMPILER_FLAGS = "-x objective-c -fno-objc-arc"; }; };
7E70899E1B587F29004D23AA /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E70899D1B587F29004D23AA /* CoreFoundation.framework */; };
7E7089A01B58801E004D23AA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E70899F1B58801E004D23AA /* Foundation.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
7E70898C1B587BF3004D23AA /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
7E70898E1B587BF3004D23AA /* ios-deploy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "ios-deploy"; sourceTree = BUILT_PRODUCTS_DIR; };
7E7089991B587DE4004D23AA /* ios-deploy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ios-deploy.c"; path = "src/ios-deploy.c"; sourceTree = SOURCE_ROOT; };
7E70899A1B587DE4004D23AA /* errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = errors.h; path = src/errors.h; sourceTree = SOURCE_ROOT; };
7E70899B1B587DE4004D23AA /* MobileDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MobileDevice.h; path = src/MobileDevice.h; sourceTree = SOURCE_ROOT; };
7E70899D1B587F29004D23AA /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
7E70899F1B58801E004D23AA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
7E70898B1B587BF3004D23AA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7E7089A01B58801E004D23AA /* Foundation.framework in Frameworks */,
7E70899E1B587F29004D23AA /* CoreFoundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
7E7089851B587BF3004D23AA = {
isa = PBXGroup;
children = (
7E7089901B587BF3004D23AA /* ios-deploy */,
7E7089A21B588219004D23AA /* Frameworks */,
7E70898F1B587BF3004D23AA /* Products */,
);
sourceTree = "<group>";
};
7E70898F1B587BF3004D23AA /* Products */ = {
isa = PBXGroup;
children = (
7E70898E1B587BF3004D23AA /* ios-deploy */,
);
name = Products;
sourceTree = "<group>";
};
7E7089901B587BF3004D23AA /* ios-deploy */ = {
isa = PBXGroup;
children = (
7E7089991B587DE4004D23AA /* ios-deploy.c */,
7E70899A1B587DE4004D23AA /* errors.h */,
7E70899B1B587DE4004D23AA /* MobileDevice.h */,
);
path = "ios-deploy";
sourceTree = "<group>";
};
7E7089A21B588219004D23AA /* Frameworks */ = {
isa = PBXGroup;
children = (
7E70899F1B58801E004D23AA /* Foundation.framework */,
7E70899D1B587F29004D23AA /* CoreFoundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
7E70898D1B587BF3004D23AA /* ios-deploy */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7E7089951B587BF3004D23AA /* Build configuration list for PBXNativeTarget "ios-deploy" */;
buildPhases = (
7E70898A1B587BF3004D23AA /* Sources */,
7E70898B1B587BF3004D23AA /* Frameworks */,
7E70898C1B587BF3004D23AA /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = "ios-deploy";
productName = "ios-deploy";
productReference = 7E70898E1B587BF3004D23AA /* ios-deploy */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
7E7089861B587BF3004D23AA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0710;
ORGANIZATIONNAME = PhoneGap;
TargetAttributes = {
7E70898D1B587BF3004D23AA = {
CreatedOnToolsVersion = 6.4;
};
};
};
buildConfigurationList = 7E7089891B587BF3004D23AA /* Build configuration list for PBXProject "ios-deploy" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 7E7089851B587BF3004D23AA;
productRefGroup = 7E70898F1B587BF3004D23AA /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
7E70898D1B587BF3004D23AA /* ios-deploy */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
7E70898A1B587BF3004D23AA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7E70899C1B587DE4004D23AA /* ios-deploy.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
7E7089931B587BF3004D23AA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-framework",
MobileDevice,
"-F/System/Library/PrivateFrameworks",
);
SDKROOT = macosx;
};
name = Debug;
};
7E7089941B587BF3004D23AA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = (
"-framework",
MobileDevice,
"-F/System/Library/PrivateFrameworks",
);
SDKROOT = macosx;
};
name = Release;
};
7E7089961B587BF3004D23AA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
7E7089971B587BF3004D23AA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
7E7089891B587BF3004D23AA /* Build configuration list for PBXProject "ios-deploy" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7E7089931B587BF3004D23AA /* Debug */,
7E7089941B587BF3004D23AA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7E7089951B587BF3004D23AA /* Build configuration list for PBXNativeTarget "ios-deploy" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7E7089961B587BF3004D23AA /* Debug */,
7E7089971B587BF3004D23AA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 7E7089861B587BF3004D23AA /* Project object */;
}

View File

@@ -1,13 +1,15 @@
{
"name": "ios-deploy",
"version": "1.7.0",
"os" : [ "darwin" ],
"description": "launch iOS apps iOS devices from the command line (Xcode 6)",
"version": "1.8.0",
"os": [
"darwin"
],
"description": "launch iOS apps iOS devices from the command line (Xcode 7)",
"main": "ios-deploy",
"scripts": {
"preinstall": "make ios-deploy"
"preinstall": "./check_reqs.js && xcodebuild"
},
"bin" : "./ios-deploy" ,
"bin": "./build/Release/ios-deploy",
"repository": {
"type": "git",
"url": "https://github.com/phonegap/ios-deploy"

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env bash
echo "$ make"
make

View File

@@ -195,6 +195,10 @@ mach_error_t AMDeviceNotificationSubscribe(am_device_notification_callback
callback, unsigned int unused0, unsigned int unused1, void* //unsigned int
dn_unknown3, struct am_device_notification **notification);
mach_error_t AMDeviceNotificationUnsubscribe(am_device_notification subscription);
/* Connects to the iPhone. Pass in the am_device structure that the
* notification callback will give to you.
*

View File

@@ -9,7 +9,29 @@ typedef struct error_id_to_message {
const char* message;
} error_id_to_message_t;
// Taken from https://github.com/samdmarshall/SDMMobileDevice/blob/master/Framework/MobileDevice/Error/SDMMD_Error.h
// Parts of error code to localization id map is taken from SDMMobileDevice framework. Associated license is bellow.
// https://github.com/samdmarshall/SDMMobileDevice/blob/master/Framework/MobileDevice/Error/SDMMD_Error.h
//
// Copyright (c) 2014, Sam Marshall
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of Sam Marshall nor the names of its contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
static errorcode_to_id_t errorcode_to_id[] = {
{ 0xe8000001, "kAMDUndefinedError" },
{ 0xe8000002, "kAMDBadHeaderError" },
@@ -168,7 +190,13 @@ static errorcode_to_id_t errorcode_to_id[] = {
{ 0xe800009b, "kAMDMCChallengeRequired" },
{ 0xe800009c, "kAMDMissingBundleVersionError" },
{ 0xe8008015, "A valid provisioning profile for this executable was not found."},
// Errors without id->string mapping.
{ 0xe8008015, "A valid provisioning profile for this executable was not found." },
{ 0xe8008016, "The entitlements specified in your applications Code Signing Entitlements file do not match those specified in your provisioning profile." },
{ 0xe8008017, "A signed resource has been added, modified, or deleted." },
{ 0xe8008018, "The identity used to sign the executable is no longer valid. Please verify that your devices clock is properly set, and that your signing certificate is not expired." },
{ 0xe8008019, "The application does not have a valid signature." },
{ 0xe800801c, "No code signature found." },
};
const int errorcode_to_id_count = sizeof(errorcode_to_id) / sizeof(errorcode_to_id_t);

View File

@@ -18,9 +18,9 @@
#include "MobileDevice.h"
#include "errors.h"
#define APP_VERSION @"1.7.0"
#define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-"
#define LLDB_SHELL "lldb -s " PREP_CMDS_PATH
#define APP_VERSION @"1.8.0"
#define PREP_CMDS_PATH @"/tmp/%@/fruitstrap-lldb-prep-cmds-"
#define LLDB_SHELL @"lldb -s %@"
/*
* Startup script passed to lldb.
* To see how xcode interacts with lldb, put this into .lldbinit:
@@ -169,7 +169,7 @@ char *app_path = NULL;
char *device_id = NULL;
char *args = NULL;
char *list_root = NULL;
int timeout = 0;
int _timeout = 0;
int port = 0; // 0 means "dynamically assigned"
CFStringRef last_path = NULL;
service_conn_t gdbfd;
@@ -179,6 +179,8 @@ pid_t child = 0;
// Signal sent from child to parent process when LLDB finishes.
const int SIGLLDB = SIGUSR1;
AMDeviceRef best_device_match = NULL;
NSString* tmpUUID;
struct am_device_notification *notify;
// Error codes we report on different failures, so scripts can distinguish between user app exit
// codes and our exit codes. For non app errors we use codes in reserved 128-255 range.
@@ -193,7 +195,7 @@ const int exitcode_app_crash = 254;
{ \
const char* msg = get_error_message(err); \
/*on_error("Error 0x%x: %s " #call, err, msg ? msg : "unknown.");*/ \
on_error(@"Error 0x%x: %s " #call, err, msg ? [NSString stringWithUTF8String:msg] : @"unknown."); \
on_error(@"Error 0x%x: %@ " #call, err, msg ? [NSString stringWithUTF8String:msg] : @"unknown."); \
} \
} while (false);
@@ -218,7 +220,7 @@ void on_sys_error(NSString* format, ...) {
NSString* str = [[[NSString alloc] initWithFormat:format arguments:valist] autorelease];
va_end(valist);
on_error(@"%@ : %@", str, errstr);
on_error(@"%@ : %@", str, [NSString stringWithUTF8String:errstr]);
}
void NSLogOut(NSString* format, ...) {
@@ -230,6 +232,15 @@ void NSLogOut(NSString* format, ...) {
[[str stringByAppendingString:@"\n"] writeToFile:@"/dev/stdout" atomically:NO encoding:NSUTF8StringEncoding error:nil];
}
BOOL mkdirp(NSString* path) {
NSError* error = nil;
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:path
withIntermediateDirectories:YES
attributes:nil
error:&error];
return success;
}
Boolean path_exists(CFTypeRef path) {
if (CFGetTypeID(path) == CFStringGetTypeID()) {
CFURLRef url = CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, true);
@@ -315,7 +326,7 @@ const char *get_home() {
CFStringRef copy_xcode_path_for(CFStringRef subPath, CFStringRef search) {
CFStringRef xcodeDevPath = copy_xcode_dev_path();
CFStringRef path;
CFStringRef path = NULL;
bool found = false;
const char* home = get_home();
CFRange slashLocation;
@@ -421,6 +432,11 @@ const CFStringRef get_device_hardware_name(const AMDeviceRef device) {
GET_FRIENDLY_MODEL_NAME(model, "N61AP", "iPhone 6 (GSM)")
GET_FRIENDLY_MODEL_NAME(model, "N56AP", "iPhone 6 Plus")
GET_FRIENDLY_MODEL_NAME(model, "N71mAP", "iPhone 6s")
GET_FRIENDLY_MODEL_NAME(model, "N71AP", "iPhone 6s")
GET_FRIENDLY_MODEL_NAME(model, "N66AP", "iPhone 6s Plus")
GET_FRIENDLY_MODEL_NAME(model, "N66mAP", "iPhone 6s Plus")
return model;
}
@@ -702,7 +718,10 @@ CFURLRef copy_device_app_url(AMDeviceRef device, CFStringRef identifier) {
CFStringRef copy_disk_app_identifier(CFURLRef disk_app_url) {
CFURLRef plist_url = CFURLCreateCopyAppendingPathComponent(NULL, disk_app_url, CFSTR("Info.plist"), false);
CFReadStreamRef plist_stream = CFReadStreamCreateWithFile(NULL, plist_url);
CFReadStreamOpen(plist_stream);
if (!CFReadStreamOpen(plist_stream)) {
on_error(@"Cannot read Info.plist file: %@", plist_url);
}
CFPropertyListRef plist = CFPropertyListCreateWithStream(NULL, plist_stream, 0, kCFPropertyListImmutable, NULL, NULL);
CFStringRef bundle_identifier = CFRetain(CFDictionaryGetValue(plist, CFSTR("CFBundleIdentifier")));
CFReadStreamClose(plist_stream);
@@ -735,7 +754,7 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
rangeLLDB.length = CFStringGetLength(pmodule);
if (args) {
CFStringRef cf_args = CFStringCreateWithCString(NULL, args, kCFStringEncodingASCII);
CFStringRef cf_args = CFStringCreateWithCString(NULL, args, kCFStringEncodingUTF8);
CFStringFindAndReplace(cmds, CFSTR("{args}"), cf_args, range, 0);
rangeLLDB.length = CFStringGetLength(pmodule);
CFStringFindAndReplace(pmodule, CFSTR("{args}"), cf_args, rangeLLDB, 0);
@@ -778,26 +797,27 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
CFStringRef disk_container_path = CFURLCopyFileSystemPath(disk_container_url, kCFURLPOSIXPathStyle);
CFStringFindAndReplace(cmds, CFSTR("{disk_container}"), disk_container_path, range, 0);
char python_file_path[300] = "/tmp/fruitstrap_";
char python_command[300] = "fruitstrap_";
NSString* python_file_path = [NSString stringWithFormat:@"/tmp/%@/fruitstrap_", tmpUUID];
mkdirp(python_file_path);
NSString* python_command = @"fruitstrap_";
if(device_id != NULL) {
strcat(python_file_path, device_id);
strcat(python_command, device_id);
python_file_path = [python_file_path stringByAppendingString:[NSString stringWithUTF8String:device_id]];
python_command = [python_command stringByAppendingString:[NSString stringWithUTF8String:device_id]];
}
strcat(python_file_path, ".py");
python_file_path = [python_file_path stringByAppendingString:@".py"];
CFStringRef cf_python_command = CFStringCreateWithCString(NULL, python_command, kCFStringEncodingASCII);
CFStringFindAndReplace(cmds, CFSTR("{python_command}"), cf_python_command, range, 0);
CFStringFindAndReplace(cmds, CFSTR("{python_command}"), (CFStringRef)python_command, range, 0);
range.length = CFStringGetLength(cmds);
CFStringRef cf_python_file_path = CFStringCreateWithCString(NULL, python_file_path, kCFStringEncodingASCII);
CFStringFindAndReplace(cmds, CFSTR("{python_file_path}"), cf_python_file_path, range, 0);
CFStringFindAndReplace(cmds, CFSTR("{python_file_path}"), (CFStringRef)python_file_path, range, 0);
range.length = CFStringGetLength(cmds);
CFDataRef cmds_data = CFStringCreateExternalRepresentation(NULL, cmds, kCFStringEncodingASCII, 0);
char prep_cmds_path[300] = PREP_CMDS_PATH;
if(device_id != NULL)
strcat(prep_cmds_path, device_id);
FILE *out = fopen(prep_cmds_path, "w");
CFDataRef cmds_data = CFStringCreateExternalRepresentation(NULL, cmds, kCFStringEncodingUTF8, 0);
NSString* prep_cmds_path = [NSString stringWithFormat:PREP_CMDS_PATH, tmpUUID];
if(device_id != NULL) {
prep_cmds_path = [prep_cmds_path stringByAppendingString:[NSString stringWithUTF8String:device_id]];
}
FILE *out = fopen([prep_cmds_path UTF8String], "w");
fwrite(CFDataGetBytePtr(cmds_data), CFDataGetLength(cmds_data), 1, out);
// Write additional commands based on mode we're running in
const char* extra_cmds;
@@ -815,9 +835,9 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
fwrite(extra_cmds, strlen(extra_cmds), 1, out);
fclose(out);
CFDataRef pmodule_data = CFStringCreateExternalRepresentation(NULL, pmodule, kCFStringEncodingASCII, 0);
CFDataRef pmodule_data = CFStringCreateExternalRepresentation(NULL, pmodule, kCFStringEncodingUTF8, 0);
out = fopen(python_file_path, "w");
out = fopen([python_file_path UTF8String], "w");
fwrite(CFDataGetBytePtr(pmodule_data), CFDataGetLength(pmodule_data), 1, out);
fclose(out);
@@ -833,8 +853,6 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
CFRelease(disk_container_url);
CFRelease(disk_container_path);
CFRelease(cmds_data);
CFRelease(cf_python_command);
CFRelease(cf_python_file_path);
}
CFSocketRef server_socket;
@@ -846,7 +864,7 @@ int kill_ptree(pid_t root, int signum);
void
server_callback (CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void *data, void *info)
{
int res;
ssize_t res;
if (CFDataGetLength (data) == 0) {
// close the socket on which we've got end-of-file, the server_socket.
@@ -956,7 +974,7 @@ int kill_ptree(pid_t root, int signum) {
return -1;
}
kill_ptree_inner(root, signum, kp, len / sizeof(struct kinfo_proc));
kill_ptree_inner(root, signum, kp, (int)(len / sizeof(struct kinfo_proc)));
free(kp);
return 0;
@@ -1050,12 +1068,15 @@ void launch_debugger(AMDeviceRef device, CFURLRef url) {
// this we setup a dummy pipe on stdin, so read() would block expecting "user's" input.
setup_dummy_pipe_on_stdin(pfd);
char lldb_shell[400];
sprintf(lldb_shell, LLDB_SHELL);
if(device_id != NULL)
strcat(lldb_shell, device_id);
NSString* lldb_shell;
NSString* prep_cmds = [NSString stringWithFormat:PREP_CMDS_PATH, tmpUUID];
lldb_shell = [NSString stringWithFormat:LLDB_SHELL, prep_cmds];
if(device_id != NULL) {
lldb_shell = [lldb_shell stringByAppendingString: [NSString stringWithUTF8String:device_id]];
}
int status = system(lldb_shell); // launch lldb
int status = system([lldb_shell UTF8String]); // launch lldb
if (status == -1)
perror("failed launching lldb");
@@ -1087,12 +1108,14 @@ void launch_debugger_and_exit(AMDeviceRef device, CFURLRef url) {
if (dup2(pfd[0],STDIN_FILENO) == -1)
perror("dup2 failed");
char lldb_shell[400];
sprintf(lldb_shell, LLDB_SHELL);
if(device_id != NULL)
strcat(lldb_shell, device_id);
int status = system(lldb_shell); // launch lldb
NSString* prep_cmds = [NSString stringWithFormat:PREP_CMDS_PATH, tmpUUID];
NSString* lldb_shell = [NSString stringWithFormat:LLDB_SHELL, prep_cmds];
if(device_id != NULL) {
lldb_shell = [lldb_shell stringByAppendingString:[NSString stringWithUTF8String:device_id]];
}
int status = system([lldb_shell UTF8String]); // launch lldb
if (status == -1)
perror("failed launching lldb");
@@ -1159,8 +1182,6 @@ void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir,
AFCConnectionOpen(afcFd, 0, &afc_conn_p);
}
NSLogOut(@"%@", [NSString stringWithUTF8String:dir]);
afc_dictionary* afc_dict_p;
char *key, *val;
int not_dir = 0;
@@ -1178,6 +1199,12 @@ void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir,
}
}
AFCKeyValueClose(afc_dict_p);
if (not_dir) {
NSLogOut(@"%@", [NSString stringWithUTF8String:dir]);
} else {
NSLogOut(@"%@/", [NSString stringWithUTF8String:dir]);
}
if (not_dir) {
if (callback) (*callback)(afc_conn_p, dir, not_dir);
@@ -1229,7 +1256,7 @@ service_conn_t start_house_arrest_service(AMDeviceRef device) {
on_error(@"Bundle id is not specified");
}
CFStringRef cf_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingASCII);
CFStringRef cf_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
if (AMDeviceStartHouseArrestService(device, cf_bundle_id, 0, &houseFd, 0) != 0)
{
on_error(@"Unable to find bundle with id: %@", bundle_id);
@@ -1301,7 +1328,7 @@ int app_exists(AMDeviceRef device)
check_error(AMDeviceValidatePairing(device));
check_error(AMDeviceStartSession(device));
CFStringRef cf_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingASCII);
CFStringRef cf_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
NSArray *a = [NSArray arrayWithObjects:@"CFBundleIdentifier", nil];
NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"];
@@ -1338,7 +1365,6 @@ void list_bundle_id(AMDeviceRef device)
const void *keys[count];
CFDictionaryGetKeysAndValues(result, keys, NULL);
for(int i = 0; i < count; ++i) {
CFStringRef test = (CFStringRef)keys[i];
NSLogOut(@"%@", (CFStringRef)keys[i]);
}
@@ -1387,21 +1413,15 @@ void copy_file_callback(afc_connection* afc_conn_p, const char *name,int file)
}
}
BOOL mkdirp(NSString* path) {
NSError* error = nil;
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:path
withIntermediateDirectories:YES
attributes:nil
error:&error];
return success;
}
void download_tree(AMDeviceRef device)
{
service_conn_t houseFd = start_house_arrest_service(device);
afc_connection* afc_conn_p = NULL;
char *dirname = NULL;
list_root = list_root? list_root : "/";
target_filename = target_filename? target_filename : ".";
NSString* targetPath = [NSString pathWithComponents:@[ @(target_filename), @(list_root)] ];
mkdirp([targetPath stringByDeletingLastPathComponent]);
@@ -1420,7 +1440,7 @@ void download_tree(AMDeviceRef device)
}
}
read_dir(houseFd, afc_conn_p, list_root?list_root:"/", copy_file_callback);
read_dir(houseFd, afc_conn_p, list_root, copy_file_callback);
} while(0);
@@ -1485,8 +1505,6 @@ void upload_file(AMDeviceRef device) {
void make_directory(AMDeviceRef device) {
service_conn_t houseFd = start_house_arrest_service(device);
afc_file_ref file_ref;
afc_connection afc_conn;
afc_connection* afc_conn_p = &afc_conn;
AFCConnectionOpen(houseFd, 0, &afc_conn_p);
@@ -1498,8 +1516,6 @@ void make_directory(AMDeviceRef device) {
void remove_path(AMDeviceRef device) {
service_conn_t houseFd = start_house_arrest_service(device);
afc_file_ref file_ref;
afc_connection afc_conn;
afc_connection* afc_conn_p = &afc_conn;
AFCConnectionOpen(houseFd, 0, &afc_conn_p);
@@ -1518,7 +1534,7 @@ void uninstall_app(AMDeviceRef device) {
CFStringRef cf_uninstall_bundle_id = NULL;
if (bundle_id != NULL)
{
cf_uninstall_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingASCII);
cf_uninstall_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
} else {
on_error(@"Error: you need to pass in the bundle id, (i.e. --bundle_id com.my.app)");
}
@@ -1556,7 +1572,7 @@ void handle_device(AMDeviceRef device) {
return;
}
if (device_id != NULL) {
CFStringRef deviceCFSTR = CFStringCreateWithCString(NULL, device_id, kCFStringEncodingASCII);
CFStringRef deviceCFSTR = CFStringCreateWithCString(NULL, device_id, kCFStringEncodingUTF8);
if (CFStringCompare(deviceCFSTR, found_device_id, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
found_device = true;
CFRelease(deviceCFSTR);
@@ -1595,7 +1611,7 @@ void handle_device(AMDeviceRef device) {
CFRetain(device); // don't know if this is necessary?
CFStringRef path = CFStringCreateWithCString(NULL, app_path, kCFStringEncodingASCII);
CFStringRef path = CFStringCreateWithCString(NULL, app_path, kCFStringEncodingUTF8);
CFURLRef relative_url = CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, false);
CFURLRef url = CFURLCopyAbsoluteURL(relative_url);
@@ -1608,7 +1624,7 @@ void handle_device(AMDeviceRef device) {
CFStringRef cf_uninstall_bundle_id = NULL;
if (bundle_id != NULL)
{
cf_uninstall_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingASCII);
cf_uninstall_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
} else {
cf_uninstall_bundle_id = get_bundle_id(url);
}
@@ -1698,7 +1714,8 @@ void device_callback(struct am_device_notification_callback_info *info, void *ar
switch (info->msg) {
case ADNCI_MSG_CONNECTED:
if(device_id != NULL || !debug || AMDeviceGetInterfaceType(info->dev) != 2) {
handle_device(info->dev);
AMDeviceNotificationUnsubscribe(*notify);
handle_device(info->dev);
} else if(best_device_match == NULL) {
best_device_match = info->dev;
CFRetain(best_device_match);
@@ -1780,6 +1797,13 @@ void show_version() {
}
int main(int argc, char *argv[]) {
// create a UUID for tmp purposes
CFUUIDRef uuid = CFUUIDCreate(NULL);
CFStringRef str = CFUUIDCreateString(NULL, uuid);
CFRelease(uuid);
tmpUUID = [(NSString*)str autorelease];
static struct option longopts[] = {
{ "debug", no_argument, NULL, 'd' },
{ "id", required_argument, NULL, 'i' },
@@ -1833,7 +1857,7 @@ int main(int argc, char *argv[]) {
verbose = 1;
break;
case 't':
timeout = atoi(optarg);
_timeout = atoi(optarg);
break;
case 'u':
unbuffered = 1;
@@ -1922,29 +1946,28 @@ int main(int argc, char *argv[]) {
setbuf(stderr, NULL);
}
if (detect_only && timeout == 0) {
timeout = 5;
if (detect_only && _timeout == 0) {
_timeout = 5;
}
if (app_path) {
if (access(app_path, F_OK) != 0) {
on_sys_error(@"Can't access app path '%@'", app_path);
on_sys_error(@"Can't access app path '%@'", [NSString stringWithUTF8String:app_path]);
}
}
AMDSetLogLevel(5); // otherwise syslog gets flooded with crap
if (timeout > 0)
if (_timeout > 0)
{
CFRunLoopTimerRef timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent() + timeout, 0, 0, 0, timeout_callback, NULL);
CFRunLoopTimerRef timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent() + _timeout, 0, 0, 0, timeout_callback, NULL);
CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopCommonModes);
NSLogOut(@"[....] Waiting up to %d seconds for iOS device to be connected", timeout);
NSLogOut(@"[....] Waiting up to %d seconds for iOS device to be connected", _timeout);
}
else
{
NSLogOut(@"[....] Waiting for iOS device to be connected");
}
struct am_device_notification *notify;
AMDeviceNotificationSubscribe(&device_callback, 0, 0, NULL, &notify);
CFRunLoopRun();
}