OK vì vậy sau một chút poking xung quanh và sử dụng plugin PhoneGap twitter như một ví dụ tôi quản lý để làm cho nó hoạt động !!
Tôi đã sử dụng điều này làm cơ sở cho cách tiếp cận của mình vì những người đáng yêu tại twitter đã cập nhật plugin của họ để làm việc với PhoneGap 1.7.0 cảm ơn Chúa !!
Twitter PhoneGap Plugin:https://github.com/phonegap/phonegap-plugins/blob/master/iOS/Twitter/js/TwitterPlugin.js
Đây là barcodescanner.js đang được cập nhật:
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();
});
Nguồn
2012-06-03 11:15:05
cảm ơn vì đã chỉ ra tên mới: com.cordova.barcodeScanner. Làm thế nào bạn tìm thấy điều này?
Tôi đã thay đổi nó trong Cordova.plist và ít nhất nó tạo ra đối tượng máy quét ok. Lưu ý rằng tệp cũ 21 giờ vẫn được tham chiếu org.apache.cordova.barcodeScanner tại https://github.com/phonegap/phonegap-plugins/blob/master/iOS/BarcodeScanner/barcodescanner.js. – GeorgeW
@damien murphy - cảm ơn bạn đời, cuối cùng sau 3 ngày tóc kéo nó hoạt động ...;) –