nateshmbhat / card-scanner-flutter

A flutter package for Fast, Accurate and Secure Credit card & Debit card scanning
https://pub.dev/packages/card_scanner
GNU General Public License v3.0
102 stars 102 forks source link

Cannot build iOS with version `^0.1.0` #7

Open thomaaam opened 4 years ago

thomaaam commented 4 years ago

Hey, your package works beautifully on Android. However on iOS I am still unsuccessful to build with the latest version. Note that when I build with version ^0.0.4 it builds successfully.

Here's what happens when I try to build ^0.1.0:

[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (GoogleDataTransport, GoogleDataTransportCCTSupport, and GoogleUtilitiesComponents)

I did google this issue and found this trick:

pre_install do |installer|
  # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

However further down the road I then ran into these issues:

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_MLKTextLine", referenced from:
      objc-class-ref in ScanProcessor.o
  "_OBJC_CLASS_$_MLKTextBlock", referenced from:
      objc-class-ref in ScanProcessor.o
  "_OBJC_CLASS_$_MLKTextRecognizer", referenced from:
      objc-class-ref in CameraViewController.o
  "_OBJC_CLASS_$_MLKVisionImage", referenced from:
      objc-class-ref in CameraViewController.o

What is curious here is that when I use ^0.1.0 over ^0.0.4 most the Firebase and Google pods are downgraded. Therefore I wonder if you use outdated Firebase/Google pods for version ^0.1.0?

This is some changes to my Podfile.lock after upgrading to ^0.1.0:

   - card_scanner (0.0.1):
     - Flutter
+    - GoogleMLKit/TextRecognition
   - Crashlytics (3.14.0):
     - Fabric (~> 1.10.2)
   - device_info (0.0.1):
@@ -25,25 +26,25 @@ PODS:
     - FBSDKLoginKit/Login (= 5.15.1)
   - FBSDKLoginKit/Login (5.15.1):
     - FBSDKCoreKit (~> 5.0)
-  - Firebase/Analytics (6.27.1):
+  - Firebase/Analytics (6.23.0):
     - Firebase/Core
-  - Firebase/Auth (6.27.1):
+  - Firebase/Auth (6.23.0):
     - Firebase/CoreOnly
-    - FirebaseAuth (~> 6.6.0)
-  - Firebase/Core (6.27.1):
+    - FirebaseAuth (~> 6.5.2)
+  - Firebase/Core (6.23.0):
     - Firebase/CoreOnly
-    - FirebaseAnalytics (= 6.6.2)
-  - Firebase/CoreOnly (6.27.1):
-    - FirebaseCore (= 6.8.1)
-  - Firebase/DynamicLinks (6.27.1):
+    - FirebaseAnalytics (= 6.4.2)
+  - Firebase/CoreOnly (6.23.0):
+    - FirebaseCore (= 6.6.7)
+  - Firebase/DynamicLinks (6.23.0):
     - Firebase/CoreOnly
-    - FirebaseDynamicLinks (~> 4.1.0)
-  - Firebase/Messaging (6.27.1):
+    - FirebaseDynamicLinks (~> 4.0.8)
+  - Firebase/Messaging (6.23.0):
     - Firebase/CoreOnly
-    - FirebaseMessaging (~> 4.5.0)
-  - Firebase/Storage (6.27.1):
+    - FirebaseMessaging (~> 4.3.1)
+  - Firebase/Storage (6.23.0):
     - Firebase/CoreOnly
-    - FirebaseStorage (~> 3.7.0)
+    - FirebaseStorage (~> 3.6.1)
   - firebase_analytics (0.0.1):
     - Firebase/Analytics (~> 6.0)
     - Firebase/Core
@@ -76,51 +77,60 @@ PODS:
   - firebase_storage (0.0.1):
     - Firebase/Storage
     - Flutter
-  - FirebaseAnalytics (6.6.2):
-    - FirebaseCore (~> 6.8)
-    - FirebaseInstallations (~> 1.4)
-    - GoogleAppMeasurement (= 6.6.2)
+  - FirebaseAnalytics (6.4.2):
+    - FirebaseCore (~> 6.6)
+    - FirebaseInstallations (~> 1.2)
+    - GoogleAppMeasurement (= 6.4.2)
     - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
     - GoogleUtilities/MethodSwizzler (~> 6.0)
     - GoogleUtilities/Network (~> 6.0)
     - "GoogleUtilities/NSData+zlib (~> 6.0)"
-    - nanopb (~> 1.30905.0)
-  - FirebaseAuth (6.6.0):
-    - FirebaseCore (~> 6.8)
+    - nanopb (= 0.3.9011)
+  - FirebaseAnalyticsInterop (1.5.0)
+  - FirebaseAuth (6.5.3):

Note how most or all pods are downgraded?

Not sure how to proceed from this, but I still cannot use card-scanner-flutter for iOS until there is a resolution to this issue. It's the only viable card scanner for Flutter as far as I can find, so I hope you have some answers!

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.69. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

m-zaink commented 4 years ago

Hey. Can you just try commenting out use_frameworks! line from ios/Podfile under your Flutter project? And run once.

thomaaam commented 4 years ago

It appears to work as pod install succeeds, but then flutter build ios fails due to this error:

fatal error: 'qr_code_scanner/qr_code_scanner-Swift.h' file not found

It appears this pod is installed successfully with use_frameworks!. Also most of my pods are downgraded again as a result of commenting out use_frameworks!

nateshmbhat commented 4 years ago

is this issue fixed ? can we close this @thomaaam @m-zaink ?

m-zaink commented 4 years ago

Let me look into it more closely then. @thomaaam

Thanks for bringing out this issue.

@nateshmbhat do not close this issue yet. I'll pick up by the weekend and fix it.

thomaaam commented 4 years ago

Did you learn anything during the weekend, @m-zaink? 😄 Just tell me if you need something more from me. We are very eager to get this out on iOS, as we currently only support it on Android.

thomaaam commented 4 years ago

I am able to get this working on iOS now with this pubspec.yaml configuration:

card_scanner:
  git:
    url: https://github.com/DeadBryam/card-scanner-flutter
    ref: fix-static-framework

Thanks to this fix: #17

PS: Though I tested on an iPhone SE (1st generation), so the layout does not look perfect, but at least it works! This might even be a cosmetic issue that applies to the latest release as well.

thomaaam commented 4 years ago

When trying to build for production I yet again faced some issues. Thus what I said over here ☝️ does not do the trick after all 😞

Undefined symbols for architecture armv7:
      "_OBJC_CLASS_$_MLKTextLine", referenced from:
          objc-class-ref in card_scanner(ScanProcessor.o)
      "_OBJC_CLASS_$_MLKTextBlock", referenced from:
          objc-class-ref in card_scanner(ScanProcessor.o)
      "_OBJC_CLASS_$_MLKTextRecognizer", referenced from:
          objc-class-ref in card_scanner(CameraViewController.o)
      "_OBJC_CLASS_$_MLKVisionImage", referenced from:
          objc-class-ref in card_scanner(CameraViewController.o)

17 is not yet a full worthy fix.

ndreisg commented 3 years ago

The reason is that MLKit does not support 32bit architectures anymore See here: https://developers.google.com/ml-kit/migration/ios

ML Kit does not support 32-bit architectures (i386 and armv7). ML Kit does support 64-bit architectures (x86_64 and arm64).

fvisticot commented 3 years ago

I am able to get this working on iOS now with this pubspec.yaml configuration:

card_scanner:
  git:
    url: https://github.com/DeadBryam/card-scanner-flutter
    ref: fix-static-framework

Thanks to this fix: #17

PS: Though I tested on an iPhone SE (1st generation), so the layout does not look perfect, but at least it works! This might even be a cosmetic issue that applies to the latest release as well.

I have used this configuration on my iPhone XS and the layout could be better. And no recognition at all. I can only see the camera but nothing is recognized

deepthi-bhattachar commented 3 years ago

We are also using version - ^0.2.0+3 and facing same issue, is there any solution for this ? If so, please let us know. [!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (GoogleUtilitiesComponents)