Cordova ViewAR Plugin: cordova-plugin-viewar
A Plugin that lets cordova apps (currently we support only iOS) use ViewAR SDK
How to use it
-
Create a new Cordova Project or if using in an existing project skip this step
$ cordova create mysample com.example.mysample MySample $ cd mysample $ cordova platform add ios
-
Install this Plugin
$cordova plugin add cordova-plugin-viewar
-
open the project in XCode and go to "Build Phases" and all the following lines in "Run Script"
cp -a ../../plugins/cordova-plugin-viewar/resources/* "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/"
-
-
ensure that you have -lstdc++ in Build Settings -> Linking -> Other Linker Flags
-
To start using ViewAR, add the following function to your index.js script and call it when needed
startViewAR: function() {
var success = function(message) { console.log('Success calling ViewAR Plugin'); }
var failure = function() { alert("Error calling ViewAR plugin!!!"); } cordova.plugins.ViewARPlugin.init('init', success, failure); }