OK, nach ein bisschen herumstöbern und mit dem twitter PhoneGap Plugin als Beispiel, habe ich es geschafft zu arbeiten !!
Ich habe dies als Grundlage für meinen Ansatz verwendet, weil die lieben Leute von Twitter ihr Plugin für PhoneGap 1.7.0 aktualisiert haben, Gott sei Dank !!
Twitter PhoneGap Plugin:https://github.com/phonegap/phonegap-plugins/blob/master/iOS/Twitter/js/TwitterPlugin.js
Hier ist die aktualisierte barcodescanner.js Code:
var BarcodeScanner = function(){};
BarcodeScanner.prototype.isBarcodeScannerAvailable = function(response){
cordova.exec(response, null, "BarcodeScannerPlugin", "isBarcodeScannerAvailable", []);
};
BarcodeScanner.prototype.isBarcodeScannerSetup = function(response){
cordova.exec(response, null, "BarcodeScannerPlugin", "isBarcodeScannerSetup", []);
};
//-------------------------------------------------------------------
BarcodeScanner.Encode = {
TEXT_TYPE: "TEXT_TYPE",
EMAIL_TYPE: "EMAIL_TYPE",
PHONE_TYPE: "PHONE_TYPE",
SMS_TYPE: "SMS_TYPE",
CONTACT_TYPE: "CONTACT_TYPE",
LOCATION_TYPE: "LOCATION_TYPE"
}
//-------------------------------------------------------------------
BarcodeScanner.prototype.scan = function(success, fail, options) {
function successWrapper(result) {
result.cancelled = (result.cancelled == 1)
success.call(null, result)
}
if (!fail) { fail = function() {}}
if (typeof fail != "function") {
console.log("BarcodeScanner.scan failure: failure parameter not a function")
return
}
if (typeof success != "function") {
fail("success callback parameter must be a function")
return
}
if (null == options)
options = []
return PhoneGap.exec(successWrapper, fail, "com.cordova.barcodeScanner", "scan", options)
}
//-------------------------------------------------------------------
BarcodeScanner.prototype.encode = function(type, data, success, fail, options) {
if (!fail) { fail = function() {}}
if (typeof fail != "function") {
console.log("BarcodeScanner.scan failure: failure parameter not a function")
return
}
if (typeof success != "function") {
fail("success callback parameter must be a function")
return
}
return PhoneGap.exec(success, fail, "com.cordova.barcodeScanner", "encode", [{type: type, data: data, options: options}])
}
cordova.addConstructor(function() {
/* shim to work in 1.5 and 1.6 */
if (!window.Cordova) {
window.Cordova = cordova;
};
if(!window.plugins) window.plugins = {};
window.plugins.barcodeScanner = new BarcodeScanner();
});
danke für den Hinweis auf den neuen Namen: com.cordova.barcodeScanner. Wie hast du das herausgefunden?
Ich habe es in Cordova.plist geändert und zumindest das Scannerobjekt ok erstellt. Beachten Sie, dass die 21-stündige Datei weiterhin auf org.apache.cordova verweist.barcodeScanner unter https://github.com/phonegap/phonegap-plugins/blob/master/iOS/BarcodeScanner/barcodescanner.js. – GeorgeW
@damien murphy - danke Kumpel, endlich nach 3 Tagen Haare ziehen funktioniert ...;) –