ठीक है तो थोड़ा सा पोकिंग करने के बाद और ट्विटर फोनगैप प्लगइन का उपयोग उदाहरण के रूप में मैं इसे काम करने में कामयाब रहा !!
मैं क्योंकि चहचहाना पर सुंदर लोगों को अपने प्लगइन अद्यतन PhoneGap 1.7.0 धन्यवाद भगवान के साथ काम करने के लिए अपने दृष्टिकोण के लिए एक आधार के रूप में इस्तेमाल !!
ट्विटर PhoneGap प्लगइन:https://github.com/phonegap/phonegap-plugins/blob/master/iOS/Twitter/js/TwitterPlugin.js
यहाँ अद्यतन barcodescanner.js कोड है:
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();
});
स्रोत
2012-06-03 11:15:05
धन्यवाद: com.cordova.barcodeScanner। आप इसे कैसे मिला?
मैंने इसे कॉर्डोवा.प्लिस्ट में बदल दिया और कम से कम इसने स्कैनर ऑब्जेक्ट को ठीक बनाया। ध्यान दें कि 21 घंटे पुरानी फ़ाइल अभी भी org.apache.cordova संदर्भित है।https://github.com/phonegap/phonegap-plugins/blob/master/iOS/BarcodeScanner/barcodescanner.js पर barcodeScanner। – GeorgeW
@damien murphy - धन्यवाद दोस्त, आखिरकार बाल खींचने के 3 दिनों के बाद यह काम करता है ...;) –