benCoding.iOS.Tools
benCoding.iOS.Tools copied to clipboard
Tools to make working with Titanium on iOS even easier.
BenCoding.iOSTools
This module contains a collection of tools designed to make working with Titanium on iOS even easier.
Before you start
* This is an iOS module designed to work with Titanium SDK 3.0.0.GA * Before using this module you first need to install the package. If you need instructions on how to install a 3rd party module please read this installation guide.Download the release
There is two ways you can download this module. The go to the dist folder. This will have a release compiled for anyone download it from github.
Building from source?
If you are building from source you will need to do the following:
- Modify the titanium.xcconfig file with the path to your Titanium installation
Setup
- Download the latest release from the releases folder ( or you can build it yourself )
- Install the bencoding.ios.tools module. If you need help here is a "How To" guide.
- You can now use the module via the commonJS require method, example shown below.
var tools = require('bencoding.ios.tools');
Ti.API.info("module is => " + tools);
AppStoreHelpers
The AppStoreHelpers object provides tools to help work with the Apple AppStore.Methods
versionCheck( String iTunesID, Callback<Object> callback )
The versionCheck method provides the ability to query the AppStore and return the latest version information for a provide iTunes ID.
Parameters
- iTunesID : String The iTunes Id for the App.
- callback : Callback<Object> Callback function to invoke when completed
Returns
- None
Example
var tools = require('bencoding.ios.tools');
var appStoreHelpers = tools.createAppStoreHelpers();
function queryResults(e){
Ti.API.info(JSON.stringify(e));
Ti.API.info("success = " + e.success);
Ti.API.info("appStoreVersion = " + e.appStoreVersion);
Ti.API.info("appID = " + e.appID);
Ti.API.info("code = " + e.code);
Ti.API.info("installedVersion = " + e.installedVersion);
var hasUpdate = (parseFloat(e.appStoreVersion) > parseFloat(e.installedVersion));
if(hasUpdate){
var alert = Ti.UI.createAlertDialog({
title:'Update now',
message:'There is a new version available. Do you want to download now?',
buttonNames : ['OK','Cancel']
});
alert.addEventListener('click', function(y){
if(y.index == 0){
appStoreHelpers.launch(queryITunesID);
}
});
alert.show();
}
};
//Let's assume we are angry birds
var queryITunesID = '409807569';
//Call the check version method
appStoreHelpers.versionCheck(queryITunesID,queryResults);
launch( String iTunesID)
Launches the AppStore for a provided iTunes Id
Parameters
- iTunesID : String The iTunes Id for the App.
Returns
- None
Example
var tools = require('bencoding.ios.tools');
var appStoreHelpers = tools.createAppStoreHelpers();
//Let's assume we are angry birds
var queryITunesID = '409807569';
//Open the App Store
appStoreHelpers.launch(queryITunesID);
Finding your iTunes Id
To find your iTunes Id open iTunes and go to your app. Right click on the App's iTunes coverart and select the Copy Link option. For example, if you do this on Angry Birds you will recieve the following url https://itunes.apple.com/us/app/angry-birds-free/id409807569?mt=8.The section after the id and before the question mark is your iTunes Id. Using our Angry Bird's example their iTunes Id would be 409807569. This is the value you will want to use when launching or performing a version check.
Licensing & Support
This project is licensed under the OSI approved Apache Public License (version 2). For details please see the license associated with each project.
Developed by Ben Bahrenburg available on twitter @benCoding
Learn More
Examples
Please check the module's example folder or [github repo](https://github.com/benbahrenburg/benCoding.iOS.Tools/tree/master/example) for samples on how to use this project.Please consider following the @benCoding Twitter for updates and more about Titanium.
Blog
For module updates, Titanium tutorials and more please check out my blog at benCoding.Com.