sawankumarbundelkhandi / edge_detection

This is a flutter plugin to detect edges in a live camera, take the picture of detected edges object, crop it, and save.
https://pub.dev/packages/edge_detection
Apache License 2.0
251 stars 247 forks source link

WeScan does not build on iOS17 as per Xcode Beta -- WeScan says they no longer support cocoapods but there are other ways to update-- #146

Closed espbee closed 1 year ago

espbee commented 1 year ago

The message from Xcode as if fails to build the app:

''' ImageScannerController.swift Stored properties cannot be marked unavailable with '@available' '''

There are 4 such messages.

WeScan has updated to address this-- they're at 3.0.0-beta.1 now, which should solve this issues. However I can't get this edge_detection lib to update WeScan: it stays on 1.7 always, using it as a trunk dependency.

I asked about updating trunk dependencies at WeScan but they said:

<<Hi @espbee, we unfortunately do not support CocoaPods for our repositories anymore. You can use it as a manual addition to your project or use Swift Package Manager.>>

@sawankumarbundelkhandi or anyone-- do you have a sense of how to address this? I can work on it but this is not really my wheelhouse yet. Seems this lib will stop working totally in iOS17.

Thanks.

sawankumarbundelkhandi commented 1 year ago

I believe first this needs to happen - https://github.com/flutter/flutter/issues/33850 and https://github.com/flutter/flutter/issues/126005. Since WeScan is now using SPM and flutter doesn't support it yet. There is nothing that can be done for this issue.

espbee commented 1 year ago

@sawankumarbundelkhandi what about the manual install option that they also mentioned? i don't claim to know if it's possible or how it goes at this point, but i'm willing to try. or do you know already that it can't be done?

Also this looks promising, from the same thread that you link above? https://github.com/flutter/flutter/issues/33850#issuecomment-1440675944

If you like I can look into this over the next couple of days. Again though, if you know it's not possible, let me know-- ?

espbee commented 1 year ago

Though I guess it involves individual package users doing things with XCode and this lib on a regular basis. I'm trying it anyway. Will report if it works but yes, I guess you're right that it's not a widely applicable solution that would work upon pubspec integration.

EDIT: For what it's worth I'm shifting to a manual cropper for now. When I find the time I'd love to work on getting Open CV to work more directly. If anyone knows otherwise, let me know but-- it seems that this lib will no longer work for ios once 17 comes out later this month?

giapnhgc commented 1 year ago

Hi, I got the same problems when build on Xcode 15. Then I fixed it. Although it is only a temporary solution, it was successful when updating Wescan 3.0.0 and running on XCode 15. I haven't tested on iOS 17 so I don't know if edge_detection can be opened on iOS 17 devices or not. You can try it out. Hope it can be of some help.

First, I forked the edge_detection project, then downloaded the wescan 3.0.0 source in the edge_detection/ios/WeScan-3.0.0 folder. Next step create a file WeScan.podspec in the WeScan-3.0.0 folder with the content below:

Pod::Spec.new do |spec|
  spec.name             = 'WeScan'
  spec.version          = '3.0.0'
  spec.summary          = 'Document Scanning Made Easy for iOS'
  spec.description      = 'WeScan makes it easy to add scanning functionalities to your iOS app! It\'s modelled after UIImagePickerController, which makes it a breeze to use.'

  spec.homepage         = 'https://github.com/WeTransfer/WeScan'
  spec.license          = { :type => 'MIT', :file => 'LICENSE' }
  spec.authors           = {
    'Boris Emorine' => 'boris@wetransfer.com',
    'Antoine van der Lee' => 'antoine@wetransfer.com'
  }
  spec.source           = { :git => 'https://github.com/WeTransfer/WeScan.git', :tag => "#{spec.version}" }
  spec.social_media_url = 'https://twitter.com/WeTransfer'

  spec.swift_version = '5.0'
  spec.ios.deployment_target = '13.0'
  spec.source_files = 'Sources/WeScan/**/*.{h,m,swift}'
  spec.resources = 'Sources/WeScan/**/*.{strings,png}'
end

You can clone this link below and add to pubspec.yaml https://github.com/giapnhgc/edge_detection.git

edge_detection:
    git:
      url: https://github.com/giapnhgc/edge_detection.git

In the example folder or in your project that uses edge_detection, you need to add this line to your Podfile: pod 'WeScan', :path => '.symlinks/plugins/edge_detection/ios/WeScan-3.0.0' =>

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'WeScan', :path => '.symlinks/plugins/edge_detection/ios/WeScan-3.0.0'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

Now run flutter clean, flutter pub get, cd ios, pod install

Screenshot 2023-09-25 at 14 04 50

Finally, run and build your project to test.

sawankumarbundelkhandi commented 1 year ago

@giapnhgc thanks for all the work you have done. Once i get the confirmation it's working from any of the user I will merge this PR.

sawankumarbundelkhandi commented 1 year ago

@espbee,

Kindly request your assistance with the testing of the recent implementation by @giapnhgc Follow the comments and instructions provided by @giapnhgc here - https://github.com/sawankumarbundelkhandi/edge_detection/issues/146#issuecomment-1733009468

Your testing and feedback is needed in ensuring the successful merge of this new implementation. Thank you for your help.

espbee commented 1 year ago

@sawankumarbundelkhandi i'll check it out as soon as i can, hopefully tomorrow nyc time.

espbee commented 1 year ago

@sawankumarbundelkhandi can confirm that this fix works. builds on xcode 15 and runs on ios17 without issue. @giapnhgc thanks a ton for doing this.

sawankumarbundelkhandi commented 1 year ago

thanks for testing and confirm @espbee I will go ahead and merge the code.

@giapnhgc thank you again for all the work.

giapnhgc commented 1 year ago

My pleasure.