2012-05-04 27 views
8

क्या कोई फ़ोनगैप 1.7.0 पर काम करने के लिए फोनगैप के लिए बारकोड स्कैनिंग प्लगइन प्राप्त करने में कामयाब रहा है?आईओएस फोनगैप 1.7.0 + बारकोड स्कैनिंग प्लगइन समस्या

बारकोड स्कैनिंग प्लगइन: https://github.com/phonegap/phonegap-plugins/tree/master/iOS/BarcodeScanner

मुद्दों है कि प्लगइन सेट नहीं हो रही है तब होता है जब उसके उतने ..

मैं जब मैं फोन निम्नलिखित मिल "चेतावनी (window.plugins.barcodeScanner);"

"अनिर्धारित"

मैं बिंदु जहां प्लगइन जोड़ा पाने के लिए विफल हो रहा है अलग करने के लिए कोशिश कर रहा हूँ और सवाल अद्यतन करेगा एक बार मैं .. और अधिक जानना किसी को जो मदद कर सकता है के लिए पहले से

धन्यवाद। ..


अपडेट किया गया जवाब नीचे:

उत्तर

6

ठीक है तो थोड़ा सा पोकिंग करने के बाद और ट्विटर फोनगैप प्लगइन का उपयोग उदाहरण के रूप में मैं इसे काम करने में कामयाब रहा !!

मैं क्योंकि चहचहाना पर सुंदर लोगों को अपने प्लगइन अद्यतन 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(); 
         }); 
+0

धन्यवाद: com.cordova.barcodeScanner। आप इसे कैसे मिला?
मैंने इसे कॉर्डोवा.प्लिस्ट में बदल दिया और कम से कम इसने स्कैनर ऑब्जेक्ट को ठीक बनाया। ध्यान दें कि 21 घंटे पुरानी फ़ाइल अभी भी org.apache.cordova संदर्भित है।https://github.com/phonegap/phonegap-plugins/blob/master/iOS/BarcodeScanner/barcodescanner.js पर barcodeScanner। – GeorgeW

+1

@damien murphy - धन्यवाद दोस्त, आखिरकार बाल खींचने के 3 दिनों के बाद यह काम करता है ...;) –

11

बहुत बढ़िया,

प्लगइन अब फिर से काम करता है।
एक मुद्दा प्लगइन के लिए दस्तावेज़ अभी भी कहते हैं Cordova.plist में महत्वपूर्ण org.apache.cordova.barcodeScanner होना चाहिए लेकिन स्पष्ट बात अब यह com.cordova.barcodeScanner होना चाहिए।

3

मैं सिर्फ कॉर्डोबा 2.3 को जोड़ा गया barcodescanner - यह काफी सरल

कॉपी करने के बाद है आवश्यक फाइलें जिन्हें आपको केवल निम्न पंक्ति को config.xml

में जोड़ने की आवश्यकता है https://github.com/zeroasterisk/PhoneGap-BarcodeScanner-Example-iOS

विशेष रूप से::

प्लगइन (पथ के एक मुट्ठी भर में) स्थापित है लेकिन एक जो काम रखा

<plugin name="org.apache.cordova.barcodeScanner" value="CDVBarcodeScanner" /> 
0

मामले में यह किसी को भी मदद करता है। कार्यक्षमता प्रदर्शित करने के लिए एक बुनियादी जे एस स्कैनर कोड लागू किया: लोड पर ऑटो चलाता है, त्रुटि पर स्वत: पुनः लोड, अलर्ट सफलता/असफलता पर/रद्द कर दें।

नोट: barcodescanner.js और index.js पर टिप्पणी, दोनों को परिभाषित/आवश्यकता वस्तु रास्तों में से मेरी अनुकूलन का उल्लेख है। कई क्रमिकताओं के बाद, मुझे काम करने के लिए डेमो/उदाहरण पथ नहीं मिल सका। नया नाम उनका कहना है के लिए