Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ee31bc677 | ||
|
|
fccfde865a | ||
|
|
f6b4c3f951 | ||
|
|
b1c717ebd8 | ||
|
|
1220cac6e4 | ||
|
|
6f65bb687e | ||
|
|
7af1a9d79b | ||
|
|
23ea3b7097 | ||
|
|
9909fb854c | ||
|
|
0320381c67 | ||
|
|
612c3561fd | ||
|
|
59904aa4c1 | ||
|
|
9f6b41519b | ||
|
|
5d2166fcef | ||
|
|
6ce22c2adc | ||
|
|
ede5d2542d | ||
|
|
6b7b31d54a | ||
|
|
8d60757e77 | ||
|
|
2f9fb4304a | ||
|
|
a6e94923cf | ||
|
|
342965c16a | ||
|
|
4ce3554561 | ||
|
|
ab39342b0f | ||
|
|
2a1844500b | ||
|
|
5e7420502b | ||
|
|
545521954b | ||
|
|
d6216760e4 | ||
|
|
0390522194 | ||
|
|
ca2e7a3c75 | ||
|
|
ed7c70aa59 | ||
|
|
093b4b3c9a | ||
|
|
4d58838ef1 | ||
|
|
d10562c501 | ||
|
|
99dba4e58c | ||
|
|
bf58b61561 | ||
|
|
d2aee71a92 | ||
|
|
92f6238bba | ||
|
|
6aa7b57014 | ||
|
|
55d076b805 | ||
|
|
3756385651 | ||
|
|
adc8a5b9c2 | ||
|
|
bb25caf586 | ||
|
|
75820a0979 | ||
|
|
16f52589db | ||
|
|
21c8dc9cf5 | ||
|
|
34540ce545 | ||
|
|
7b834b0e31 | ||
|
|
7ac9cdb107 | ||
|
|
cf9d024a2b | ||
|
|
bc1bb0d320 | ||
|
|
7d997b89c7 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,6 +1,4 @@
|
||||
demo
|
||||
demo.app
|
||||
ios-deploy
|
||||
ios-deploy.dSYM
|
||||
build/*
|
||||
node_modules/*
|
||||
/.DS_Store
|
||||
*~
|
||||
|
||||
35
Makefile
35
Makefile
@@ -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
|
||||
22
README.md
22
README.md
@@ -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
|
||||
|
||||
@@ -32,13 +32,21 @@ Now install ios-deploy with the [node.js](https://nodejs.org) package manager:
|
||||
npm install -g ios-deploy
|
||||
```
|
||||
|
||||
To install from source:
|
||||
To build from source:
|
||||
|
||||
```
|
||||
make install prefix=/usr/local
|
||||
xcodebuild
|
||||
```
|
||||
|
||||
This will install ios-deploy in the `bin` folder of `/usr/local`, i.e. `/usr/local/bin`
|
||||
This will build `ios-deploy` into the `build/Release` folder.
|
||||
|
||||
|
||||
### 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
|
||||
|
||||
@@ -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
|
||||
|
||||
5
demo/.gitignore
vendored
Normal file
5
demo/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
demo
|
||||
demo.app
|
||||
demo.dSYM
|
||||
/.DS_Store
|
||||
*~
|
||||
24
demo/Makefile
Normal file
24
demo/Makefile
Normal 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
|
||||
@@ -6,4 +6,4 @@ int main(int argc, const char* argv[]) {
|
||||
printf("argv[%d] = %s\n", i, argv[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
275
ios-deploy.xcodeproj/project.pbxproj
Normal file
275
ios-deploy.xcodeproj/project.pbxproj
Normal 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 */;
|
||||
}
|
||||
22
package.json
22
package.json
@@ -1,21 +1,33 @@
|
||||
{
|
||||
"name": "ios-deploy",
|
||||
"version": "1.7.0",
|
||||
"os" : [ "darwin" ],
|
||||
"description": "launch iOS apps iOS devices from the command line (Xcode 6)",
|
||||
"version": "1.8.2",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"description": "launch iOS apps iOS devices from the command line (Xcode 7)",
|
||||
"main": "ios-deploy",
|
||||
"scripts": {
|
||||
"preinstall": "make ios-deploy"
|
||||
},
|
||||
"bin" : "./ios-deploy" ,
|
||||
"bin": "./build/Release/ios-deploy",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phonegap/ios-deploy"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint": "2.5.8"
|
||||
},
|
||||
"scripts": {
|
||||
"preinstall": "./src/check_reqs.js && xcodebuild",
|
||||
"test": "npm run jshint",
|
||||
"jshint": "node node_modules/jshint/bin/jshint src"
|
||||
},
|
||||
"keywords": [
|
||||
"ios-deploy",
|
||||
"deploy to iOS device"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/phonegap/ios-deploy/issues"
|
||||
},
|
||||
"author": "Greg Hughes",
|
||||
"license": "GPLv3"
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "$ make"
|
||||
make
|
||||
@@ -195,6 +195,7 @@ 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);
|
||||
|
||||
|
||||
/* Connects to the iPhone. Pass in the am_device structure that the
|
||||
* notification callback will give to you.
|
||||
*
|
||||
45
src/check_reqs.js
Executable file
45
src/check_reqs.js
Executable 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.0';
|
||||
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);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -192,6 +192,8 @@ static errorcode_to_id_t errorcode_to_id[] = {
|
||||
|
||||
// Errors without id->string mapping.
|
||||
{ 0xe8008015, "A valid provisioning profile for this executable was not found." },
|
||||
{ 0xe8008016, "The entitlements specified in your application’s 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 device’s 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." },
|
||||
@@ -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.2"
|
||||
#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.
|
||||
@@ -218,16 +220,38 @@ 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, va_list valist) {
|
||||
NSString* str = [[[NSString alloc] initWithFormat:format arguments:valist] autorelease];
|
||||
[[str stringByAppendingString:@"\n"] writeToFile:@"/dev/stdout" atomically:NO encoding:NSUTF8StringEncoding error:nil];
|
||||
}
|
||||
|
||||
void NSLogOut(NSString* format, ...) {
|
||||
va_list valist;
|
||||
va_start(valist, format);
|
||||
NSString* str = [[[NSString alloc] initWithFormat:format arguments:valist] autorelease];
|
||||
__NSLogOut(format, valist);
|
||||
va_end(valist);
|
||||
}
|
||||
|
||||
[[str stringByAppendingString:@"\n"] writeToFile:@"/dev/stdout" atomically:NO encoding:NSUTF8StringEncoding error:nil];
|
||||
void NSLogVerbose(NSString* format, ...) {
|
||||
if (verbose) {
|
||||
va_list valist;
|
||||
va_start(valist, format);
|
||||
__NSLogOut(format, valist);
|
||||
va_end(valist);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
@@ -315,7 +339,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 +445,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;
|
||||
}
|
||||
|
||||
@@ -452,11 +481,8 @@ CFStringRef get_device_full_name(const AMDeviceRef device) {
|
||||
device_name = AMDeviceCopyValue(device, 0, CFSTR("DeviceName")),
|
||||
model_name = get_device_hardware_name(device);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
NSLogOut(@"Device Name: %@", device_name);
|
||||
NSLogOut(@"Model Name: %@", model_name);
|
||||
}
|
||||
NSLogVerbose(@"Device Name: %@", device_name);
|
||||
NSLogVerbose(@"Model Name: %@", model_name);
|
||||
|
||||
if(device_name != NULL && model_name != NULL)
|
||||
{
|
||||
@@ -594,11 +620,9 @@ void mount_developer_image(AMDeviceRef device) {
|
||||
CFStringRef image_path = copy_developer_disk_image_path(device);
|
||||
CFStringRef sig_path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@.signature"), image_path);
|
||||
|
||||
if (verbose) {
|
||||
NSLogOut(@"Device support path: %@", ds_path);
|
||||
NSLogOut(@"Developer disk image: %@", image_path);
|
||||
}
|
||||
CFRelease(ds_path);
|
||||
NSLogVerbose(@"Device support path: %@", ds_path);
|
||||
NSLogVerbose(@"Developer disk image: %@", image_path);
|
||||
CFRelease(ds_path);
|
||||
|
||||
FILE* sig = fopen(CFStringGetCStringPtr(sig_path, kCFStringEncodingMacRoman), "rb");
|
||||
void *sig_buf = malloc(128);
|
||||
@@ -702,7 +726,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 +762,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 +805,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 +843,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 +861,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 +872,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 +982,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 +1076,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 +1116,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");
|
||||
|
||||
@@ -1104,8 +1135,7 @@ void launch_debugger_and_exit(AMDeviceRef device, CFURLRef url) {
|
||||
_exit(WEXITSTATUS(status));
|
||||
} else if (pid > 0) {
|
||||
child = pid;
|
||||
if (verbose)
|
||||
NSLogOut(@"Waiting for child [Child: %d][Parent: %d]\n", child, parent);
|
||||
NSLogVerbose(@"Waiting for child [Child: %d][Parent: %d]\n", child, parent);
|
||||
} else {
|
||||
on_sys_error(@"Fork failed");
|
||||
}
|
||||
@@ -1159,8 +1189,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 +1206,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 +1263,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 +1335,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 +1372,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 +1420,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 +1447,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 +1512,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 +1523,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 +1541,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)");
|
||||
}
|
||||
@@ -1543,8 +1566,7 @@ void uninstall_app(AMDeviceRef device) {
|
||||
}
|
||||
|
||||
void handle_device(AMDeviceRef device) {
|
||||
//if (found_device)
|
||||
// return; // handle one device only
|
||||
NSLogVerbose(@"Already found device? %d", found_device);
|
||||
|
||||
CFStringRef found_device_id = AMDeviceCopyDeviceIdentifier(device),
|
||||
device_full_name = get_device_full_name(device),
|
||||
@@ -1556,7 +1578,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 +1617,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 +1630,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,8 +1720,10 @@ 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);
|
||||
NSLogVerbose(@"Handling device type: %d", AMDeviceGetInterfaceType(info->dev));
|
||||
handle_device(info->dev);
|
||||
} else if(best_device_match == NULL) {
|
||||
NSLogVerbose(@"Best device match: %d", AMDeviceGetInterfaceType(info->dev));
|
||||
best_device_match = info->dev;
|
||||
CFRetain(best_device_match);
|
||||
}
|
||||
@@ -1711,6 +1735,7 @@ void device_callback(struct am_device_notification_callback_info *info, void *ar
|
||||
void timeout_callback(CFRunLoopTimerRef timer, void *info) {
|
||||
if ((!found_device) && (!detect_only)) {
|
||||
if(best_device_match != NULL) {
|
||||
NSLogVerbose(@"Handling best device match.");
|
||||
handle_device(best_device_match);
|
||||
|
||||
CFRelease(best_device_match);
|
||||
@@ -1733,11 +1758,8 @@ void timeout_callback(CFRunLoopTimerRef timer, void *info) {
|
||||
int mypid = getpid();
|
||||
if ((parent != 0) && (parent == mypid) && (child != 0))
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
NSLogOut(@"Timeout. Killing child (%d) tree.", child);
|
||||
}
|
||||
kill_ptree(child, SIGHUP);
|
||||
NSLogVerbose(@"Timeout. Killing child (%d) tree.", child);
|
||||
kill_ptree(child, SIGHUP);
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
@@ -1780,6 +1802,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 +1862,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 +1951,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, ¬ify);
|
||||
CFRunLoopRun();
|
||||
}
|
||||
Reference in New Issue
Block a user