Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here you are presented with 3 options.  For this tutorial, the community edition will suffice. Once you select an option, you will receive instructions on registering and an email confirming your registration. From there, you will be presented with a link to download the SDKs. You will need to download both the Barcode Scanner SDK for iOS, Community version and PhoneGap Plugin for Barcode Scanner SDK for iOS

After the downloads are finished, extract the contents to a folder on your computer.

...

1. Find the main folder for your Xcode project, in this example case BarcodeScan. Inside of your SDK download (as of this writing, the default folder name of the extracted SDK download is scanditsdk-community-ios_2.2.4), locate and copy the ScanditSDK folder and then go to BarcodeScan->barcodeScan->Plugins and paste the ScanditSDK folder you copied into here.

2. Inside of your extracted* extracted PhoneGap Plugin for Barcode Scanner SDK for iOS folder  *folder *(as of this writing, default name is *scanditsdk-phonegap-plugin-iphone_1.0.8, go into CordovaDemo->CordovaDemo>CordovaDemo->Plugins>Plugins, and copy the files ScanditSDKRotatingBarcodePicker.hScanditSDKRotatingBarcodePicker.m, ScanditSDK.h, and ScanditSDK.mm  into the same Plugins folder of your XCode project that you placed ScanditSDK in.  

...

4. Right click on your project and select "Add files to..."and select the ScanditSDK folder you copied into Plugins in Step 1

5. Right click on the Plugins folder listed inside of your project in XCode and select "Add files to.." and select the files you copied in Step 2

6. Select your project and click the Build Phases tab. Under Link Binary With Libraries, select the plus button and add the following frameworks:

AudioToolbox.framework
AVFoundation.framework
CoreGraphics.framework
CoreLocation.framework
CoreMedia.framework
CoreVideo.framework
QuartzCore.framework
SystemConfiguration.framework
libiconv.dylib
libz.dylib

7. In the Resources folder of your project, locate the Cordova.plist file. Under the Plugins entry, add a new entry of type String with "ScanditSDK" as the Key and "ScanditSDK" as the Value.

8. At this point, the scanner can be called by calling cordova.exec with the following arguments:

  • argument #1: function to be called when the scan succeeds.
  • argument #2: function to be called when cancel button is pressed
  • argument #3: name of the plugin, which is "ScanditSDK"
  • argument #4: name of the function of the plugin to be called, which is "scan"
  • argument #5: an array where the first item is the Scandit SDK app key (available from your Scandit SDK web account) and the second item is a dictionary with customization options (listed in ScanditSDK.java

Below is an example call to cordova.exec():

Code Block
javascript
javascript



function scan() {
 cordova.exec(success, failure, "ScanditSDK", "scan",
 ["123456abcdefg",
 {"beep": true,
 "1DScanning": true,
 "2DScanning": true,
 "scanningHotspot": "0.5/0.5",
 "vibrate": true}]);
}