alon22 / cordova-plugin-firebase-mlvision

Cordova plugin for Firebase MLKit Vision
MIT License
13 stars 15 forks source link

Plugin Not working for Ionic 3 #10

Open angela-tithi opened 3 years ago

angela-tithi commented 3 years ago

I used this plugin in my Ionic 3 project, I got this error as per the issue written in "Know Issues" section - PhaseScriptExecution [CP] Copy Pods Resources; and my build failed.

So because the suggestion was to run project from Xcode, I opened the .xcworkspace file in xcode and ran the project. But I got this error -

ERROR: ERROR Error: Uncaught (in promise): TypeError: Object(WEBPACK_IMPORTED_MODULE_2ionic_native_core["cordova"]) is not a function. (In 'Object(__WEBPACK_IMPORTED_MODULE_2ionic_native_core["cordova"])(this, "barcodeDetector", {}, arguments)', 'Object(WEBPACK_IMPORTED_MODULE_2ionic_native_core["cordova"])' is an instance of Object)

Is this occurring because of incompatibility of ionic version? Please help me out!

angela-tithi commented 3 years ago

@alon22 please help :(

angela-tithi commented 3 years ago

@alon22 okay, update is that I followed https://ionicframework.com/docs/native/firebase-vision this link, and used

this.firebaseVision.barcodeDetector(FILE_URI) .then((res: Barcode[]) => console.log(res)) .catch((error: string) => console.error(error));

//FILE_URI: File URI or Base64 Format FirebaseVisionPlugin.barcodeDetector(FILE_URI, (json) => { console.log(json); }, (error) => { console.error(error);; }) })

,but now I am getting "Cannot find FirebaseVisionPlugin" :(

alon22 commented 3 years ago

You should to be able to user the promise with the latest version of @ionic-native/firebase-vision. If you not use ionic-native, you have to add declare var FirebaseVisionPlugin at top of your page.

angela-tithi commented 3 years ago

Thanks Alonso!

I added declare var FirebaseVisionPlugin at top and it worked. But I got into another trouble. At first I provided base64 image, but got the error "unsupported URL", next I changed "destinationType: this.camera.DestinationType.FILE_URI" this configuration in the camera options and provided the file uri, but also got this "Image URL required" error. It would be very helpful if I can provide the base64 image as input. Please help me out @alon22 :(

alon22 commented 3 years ago

To use base64 image the string must be contain data:image/jpeg;base64, or data:image/png;base64,. If you are using camera-plugin add one of the two options at start of the result.

angela-tithi commented 3 years ago

@alon22 Thank you so much for your help Alonso! It worked! I have one more question left. Does this PhaseScriptExecution error cause any problem while uploading the app to the app store?

angela-tithi commented 3 years ago

@alon22, I uploaded the app in app store, it didn't cause any problem fortunately , but can you please try to solve the phase exception error that is occurring? :( Whenever I build the project it is hard to look for other errors that occur :(

eduvega commented 3 years ago

Hi, I need to know more about this pluggin. How do I make it work? Do I have to add a new plugging for the Base64 thing? Please help I'm a little lost