I use Phonegap Desktop and Phonegap Developer app for a while now. This is really interesting for quickly testing my development. But I'm facing a limitation with the embedded barcode scanner which is displaying the camera display in full screen. I need to embed the camera display into a container so I have space for displaying information in the same time.
After searching for a while, I've discovered the Scandit SDK for PhoneGap was the only plugin which allows cropping the camera display.
I spent a lot of time trying to implement Scandit, but no success. At least I can build the app, but when using it, scanner is not working...
Here are the steps I've followed:
- clone the PhoneGap Developer project from Git
- Install using npm
- add ios platform
- open the xcode project file
- build the application and run it on device
=> At this time the PG Dev is running well and my application is working fine
Then, i continued:
- remove all reference to the default barcode scanner plugin
- build the application and run it on device
==> PG Dev still working fine and my application is working fine
Next steps:
- clone the Scandit phonegap plugin from Git
- download the Scandit SDK from my scandit account
- put the SDK into the cloned scandit phonegap plugin
- modify the plugin.xml to change the path to the bundle and framework (mismatch of version name in the path)
<resource-file src="src/ios/scanditsdk-community-ios_4.16.1/ScanditBarcodeScanner.bundle"/> <framework src="src/ios/scanditsdk-community-ios_4.16.1/ScanditBarcodeScanner.framework" custom="true"/>
- copy bundle and framework into the correct folder of scandit
- modify the config.xml to include reference to Scandit and set the spec attribut to the version of the SDK
- build the application and run it on device
==> PG Dev still working fine and my application is working fine (it doesn't use scandit for the moment)
Next steps:
- Remove my project from PhoneGap desktop
- add Scandit Sample project to PG Desktop I used the "Continuous Scaled/Cropped" example from there: http://docs.scandit.com/4.12/phonegap/cordova-examples.html
- add my App Key for the license
- launch my PG Dev app on my device and download the project files
==> PG Dev is running fine and download the Scandit Sample App. But the app doesn't work. When clicking on the scan button, nothing happends..
After some investigation, I found that I ran through an exception on Scandit class. Adding a try on the command 'Scandit.License.setAppKey' allowed me to report in the PG Desktop log the following error:
ReferenceError: Can't find variable: Scandit
Adding this try/catch made the app raising an exception at the next line:
var settings = new Scandit.ScanSettings();
After searching the web about my error, and some posts were suggesting to manually add the framework and bundle into xcode.
So I did it by drag&droping the framework and bundle into the framework folder of the xcode project.
But when I try building my project, it is failing with many errors... To solve it, I had to had manually all the scandit plugin files (*.h and *.m) into my xcode project.
All previous errors have been solved, but new ones appeared. This was due to some other missing native ios frameworks... Once these framework added, all errors were solved and I managed to successfully build the application.
But when running it, I'm still having the error: "ReferenceError: Can't find variable: Scandit"
I'm now running out of idea.. What did I do wrong? Is there anyone having managed to build a PG Desktop with Scandit embedded?
Thanks.
Sorry for this long post, just tried to be the more precise I could be.