Skip to content

Added support for Xcode 6 and iOS 8. #5

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
build
_tmp
out
._*
.DS_Store
npm-debug.log
node_modules
test/TestApp/build
test/TestApp/TestApp.xcodeproj/project.xcworkspace/xcuserdata
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
._*
.DS_Store
.git*
node_modules
test/TestApp/build
test/TestApp/TestApp.xcodeproj/project.xcworkspace/xcuserdata
30 changes: 30 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,33 @@ Copyright 2014 by Appcelerator, Inc.
See the License for the specific language governing permissions and
limitations under the License.

-------------------------------------------------------------------------------

lib/certs.js contains code from the "forge" project.
https://github.com/digitalbazaar/forge

New BSD License (3-clause)
Copyright (c) 2010, Digital Bazaar, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Digital Bazaar, Inc. 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 DIGITAL BAZAAR 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.
251 changes: 165 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,163 +1,242 @@
iOS Utility Library
===================
# iOS Utility Library

This is a library of utilities for dealing programmatically with iOS applications, used namely for tools like [Hyperloop](https://github.com/appcelerator/hyperloop) and [Titanium](https://github.com/appcelerator/titanium).
This is a library of utilities for dealing programmatically with iOS applications,
used namely for tools like [Hyperloop](https://github.com/appcelerator/hyperloop)
and [Titanium](https://github.com/appcelerator/titanium).

## Current Status [![Build Status](https://travis-ci.org/appcelerator/ioslib.svg?branch=master)](https://travis-ci.org/appcelerator/ioslib) [![NPM version](https://badge.fury.io/js/ioslib.svg)](http://badge.fury.io/js/ioslib)
ioslib supports Xcode 5 and Xcode 6.

- currently in progress of porting various internal libraries into this library
- [node-ios-device](https://github.com/appcelerator/node-ios-device) is currently the main library used by Titanium at the moment. we will merge these two projects once this one is complete.
[![Build Status](https://travis-ci.org/appcelerator/ioslib.svg?branch=master)](https://travis-ci.org/appcelerator/ioslib) [![NPM version](https://badge.fury.io/js/ioslib.svg)](http://badge.fury.io/js/ioslib)

Examples
--------
[![NPM](https://nodei.co/npm/ioslib.png?downloads=true&stars=true)](https://nodei.co/npm/ioslib/)

## Prerequisites

This library current depends on [node-ios-device](https://github.com/appcelerator/node-ios-device)
and thus is currently compatible with Node.js version 0.8.0 through 0.11.13.

## Installation

From NPM:

npm install ioslib

From GitHub:

npm install git://github.com/appcelerator/ioslib.git

## Examples

### Detect all the connected iOS devices:

```javascript
var ioslib = require('ioslib');

ioslib.device.detect(function(err,devices){
if (!err && devices.length) {
console.log('detected',devices);
ioslib.device.detect(function (err, devices) {
if (err) {
console.error(err);
} else {
console.log(devices);
}
});
```

### Install and then launch an application on device
### Install an application on device

```javascript
var ioslib = require('ioslib');
var obj = {
build_dir: '/path/to/name.app',
callback: function(err) {
console.log('exited');
},
logger: function(label, message) {
console.log('['+label+']',message);
}
}
ioslib.device.launch(obj);
```

### Install and then launch an application on simulator
var deviceUDID = null; // string or null to pick first device

ioslib.device.install(deviceUDID, '/path/to/name.app', 'com.company.appname')
.on('installed', function () {
console.log('App successfully installed on device');
})
.on('appStarted', function () {
console.log('App has started');
})
.on('log', function (msg) {
console.log('[LOG] ' + msg);
})
.on('appQuit', function () {
console.log('App has quit');
})
.on('error', function (err) {
console.error(err);
});
```

### Launch the iOS Simulator

```javascript
var ioslib = require('ioslib');
var obj = {
build_dir: '/path/to/name.app',
callback: function(err) {
console.log('exited');
},
logger: function(label, message) {
console.log('['+label+']',message);
}
}
ioslib.simulator.launch(obj);
ioslib.simulator.launch(null, function (err, simHandle) {
console.log('Simulator launched');
ioslib.simulator.stop(simHandle, function () {
console.log('Simulator stopped');
});
});
```

### Force stop an application running on simulator
### Launch, install, and run an application on simulator

```javascript
var ioslib = require('ioslib');
ioslib.simulator.stop(function(){
console.log('simulator has exited');
});
var simUDID = null; // string or null to pick a simulator

ioslib.simulator.launch(simUDID, {
appPath: '/path/to/name.app'
})
.on('launched', function (msg) {
console.log('Simulator has launched');
})
.on('appStarted', function (msg) {
console.log('App has started');
})
.on('log', function (msg) {
console.log('[LOG] ' + msg);
})
.on('error', function (err) {
console.error(err);
});
```

### Force stop an application running on device
### Force stop an application running on simulator

```javascript
var ioslib = require('ioslib');
ioslib.device.stop(function(){
console.log('device app has exited');
});
ioslib.simulator.launch(simUDID, {
appPath: '/path/to/name.app'
})
.on('launched', function (simHandle) {
console.log('Simulator launched');
ioslib.simulator.stop(simHandle).on('stopped', function () {
console.log('Simulator stopped');
});
});
```

### Find provisioning profiles and developer info
### Find a valid device/cert/provisioning profile combination

```javascript
var ioslib = require('ioslib');
ioslib.profile.find('com.appcelerator.test',function(err,results){
console.log('profiles',results.profiles);
console.log('developer_name',results.developer_name);
ioslib.findValidDeviceCertProfileCombos({
appId: 'com.company.appname'
}, function (err, results) {
if (err) {
console.error(err);
} else {
console.log(results);
}
});
```

### Detect Xcode path
### Detect everything

```javascript
var ioslib = require('ioslib');
ioslib.xcode.detect(function(err,path){
console.log('xcode path',path);
ioslib.detect(function (err, info) {
if (err) {
console.error(err);
} else {
console.log(info);
}
});
```

### Detect Xcode settings
### Detect iOS certificates

```javascript
var ioslib = require('ioslib');
ioslib.xcode.settings(function(err,settings){
console.log('xcode settings',settings);
ioslib.certs.detect(function (err, certs) {
if (err) {
console.error(err);
} else {
console.log(certs);
}
});
```

### Detect Xcode system frameworks
### Detect provisioning profiles

```javascript
var ioslib = require('ioslib');
ioslib.xcode.systemFrameworks(function(err,frameworks,frameworkDir){
console.log('xcode frameworks',frameworks);
ioslib.provisioning.detect(function (err, profiles) {
if (err) {
console.error(err);
} else {
console.log(profiles);
}
});
```

### Detect thirdparty frameworks from given directory
### Detect Xcode installations

```javascript
xcode.frameworksFromDir('/Thirdparty/Frameworks/',function(err,frameworks){
console.log(frameworks);
ioslib.xcode.detect(function (err, xcodeInfo) {
if (err) {
console.error(err);
} else {
console.log(xcodeInfo);
}
});
```

## Command line
## Running Tests

There is also a simple command line:
For best results, connect an iOS device.

### Print out basic information about device
To run all tests:

```
> ioslib
npm test
```

### Print out JSON
To run a specific test suite:

```
> ioslib --json
```
npm run-script test-certs

### Print out Titanium CLI flags
npm run-script test-device

```
> ioslib --ti
npm run-script test-env

--platform ios --target device --device-id 123456987978978978789 --developer-name "Foo Bar (95FMZAQKCH)" --pp-uuid 78B3D052-E2B8-4268-8812-D83FB9EC3788
```
npm run-script test-ioslib

npm run-script test-provisioning

## Reporting Bugs or submitting fixes
npm run-script test-simulator

If you run into problems, and trust us, there are likely plenty of them at this point -- please create an [Issue](https://github.com/appcelerator/ioslib/issues) or, even better, send us a pull request.
npm run-script test-xcode
```

## Contributing
## Known Issues

Simulator tests fail due to issue with NSLog() calls not properly being logged
and thus we don't know when tests are done. The result is the tests timeout.

ioslib is an open source project. ioslib wouldn't be where it is now without contributions by the community. Please consider forking ioslib to improve, enhance or fix issues. If you feel like the community will benefit from your fork, please open a pull request.
## Reporting Bugs or Submitting Fixes

To protect the interests of the ioslib contributors, Appcelerator, customers and end users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is simple and straightforward - it requires that the contributions you make to any Appcelerator open source project are properly licensed and that you have the legal authority to make those changes. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes only a few minutes, and only needs to be completed once.
If you run into problems, and trust us, there are likely plenty of them at this
point -- please create an [Issue](https://github.com/appcelerator/ioslib/issues)
or, even better, send us a pull request.

## Contributing

[You can digitally sign the CLA](http://bit.ly/app_cla) online. Please indicate your email address in your first pull request so that we can make sure that will locate your CLA. Once you've submitted it, you no longer need to send one for subsequent submissions.
ioslib is an open source project. ioslib wouldn't be where it is now without
contributions by the community. Please consider forking ioslib to improve,
enhance or fix issues. If you feel like the community will benefit from your
fork, please open a pull request.

To protect the interests of the ioslib contributors, Appcelerator, customers
and end users we require contributors to sign a Contributors License Agreement
(CLA) before we pull the changes into the main repository. Our CLA is simple and
straightforward - it requires that the contributions you make to any
Appcelerator open source project are properly licensed and that you have the
legal authority to make those changes. This helps us significantly reduce future
legal risk for everyone involved. It is easy, helps everyone, takes only a few
minutes, and only needs to be completed once.

[You can digitally sign the CLA](http://bit.ly/app_cla) online. Please indicate
your email address in your first pull request so that we can make sure that will
locate your CLA. Once you've submitted it, you no longer need to send one for
subsequent submissions.

## Contributors

The original source and design for this project was developed by [Jeff Haynie](http://github.com/jhaynie) ([@jhaynie](http://twitter.com/jhaynie)).
The original source and design for this project was developed by
[Jeff Haynie](http://github.com/jhaynie) ([@jhaynie](http://twitter.com/jhaynie)).

## Legal

Expand Down
Loading