Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Apache Cordova (PhoneGap) plugin
Objective-C JavaScript
branch: master
Failed to load latest commit information.
src/ios Updated Torch plugin for the latest version of Cordova
www Updated Torch plugin for the latest version of Cordova
README.md Updated Torch plugin for the latest version of Cordova
plugin.xml

README.md

Torch Plugin for Apache Cordova

created by Shazron Abdullah

Apache 2.0 License

Follows the Cordova Plugin spec, so that it works with Plugman, or you can install it manually below.

  1. Add the plugin files (CDVTorch.h, CDVTorch.m) in Xcode (add as a group)
  2. Add torch.js to your www folder, and reference it in a script tag, after your cordova.js
  3. a. For Cordova.plist, under the 'Plugins' key, add a new row: key is "Torch" and the value is "CDVTorch"

    b. For config.xml, under the <plugins> tag, add this (deprecated, 2.7.0 and below):

     <plugin name="Torch" value="CDVTorch" />
    

    c. For config.xml, add a new <feature> tag (2.8.0 and up):

     <feature name="Torch">
        <param name="ios-package" value="CDVTorch" />
     </feature>
    
  4. Add the Framework "AVFoundation.framework" in your Build Phases tab of your Project, and set it to be weak linked

The plugin's JavaScript functions are called after getting the plugin object thus:

    var torch = cordova.require("cordova/plugin/torch");
    torch.on();
    torch.off();
    if (torch.isOn) {
        // do something
    }
Something went wrong with that request. Please try again.