created by Shazron Abdullah updated by Lukas Beaton
Using this plugin requires iOS Cordova 2.3.0 and AVFoundation. AVFoundation requires the iOS 6 SDK.
- Add the "AVFoundation" framework to your project, and set it to be weak linked (see "Weak Linking the AVFoundation Framework" section below).
- Add the .h and .m files to your Plugins folder in your project
- Add the .js files to your "www" folder on disk, and add reference(s) to the .js files as tags in your html file(s)
- Add the plugin to your config.xml file in xCode:
- See the sample code in "index.html" for an example use
Xcode 3
- In your project, under "Targets", double click on the Target item
- Go to the "General" Tab, under "Linked Libraries"
- For the AVFoundation Framework, change the value from "Required" to "Weak"
Xcode 4
- In your project, select your blue project icon in the Project Navigator
- On the right pane, select the "Build Phases" tab
- Expand the "Link Binary with Libraries" item
- For the AVFoundation Framework, change the value from "Required" to "Optional"
- Initial release
- iOS devices with no flash/torch support will just fail gracefully
- Based off code here
Post issues in the PhoneGap Google Groups, include in the subject heading - "TorchPlugin" or on Github (preferred)
The MIT License
Copyright (c) 2011 Shazron Abdullah
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.