Open navaronbracke opened 3 months ago
@navaronbracke are you working on this change? Or can I give it a shot?
I was planning on taking this up, but haven't gotten around to doing so yet. Feel free to take this up!
Also, if you think that doing https://github.com/juliansteenbakker/mobile_scanner/issues/782 first, would make things easier, feel free to do so! And if not, we can revisit that one later.
@navaronbracke I'll give this one a try first
@navaronbracke I followed the documentation mentioned in the work item and made the appropriate changes.
If we migrate to swift package manager, I’m encountering an error "Parse Issue (Xcode): Module 'image_picker_ios' not found” this seems to be a common issue with this module when we switch over to swift package manager.
Found an open issue in Git : https://github.com/flutter/flutter/issues/152550
These new changes will not affect the existing Cocoapods installation and build process.
The plugin works fine when run with the flag "flutter config --no-enable-swift-package-manager” after adding the SPM changes.
Issue only comes up when we run with "flutter config --enable-swift-package-manager”.
We can try removing this module and attempting to build but I’m not sure if this is a viable solution as it might remove a functionality from the plugin.
Changes are present here : https://github.com/Xa69/mobile_scanner/tree/users/nimish/1150-SPM-Support-Changes
Let me know if I should try by removing the module itself.
Good finding! I had a look and I see that https://github.com/flutter/packages/pull/6833 is a reland of Swift Package Manager support for that plugin. (the first attempt was reverted due to the issue you found)
I see that the pubspec of our example does not use the latest version of image_picker
.
image_picker_ios
version 0.8.12
should fix that, but I'm not sure if the latest version of image_picker
already uses that version.
You could try the following:
1) Bump the example's image_picker dependency to the latest version (image_picker: ^1.1.2
)
2) If step 1 still does not fix the issue, depend on image_picker_ios: ^0.8.12
as well (so depend on both image_picker and image_picker_ios in the example pubspec) Also add a note to remove the image_picker_ios
dependency when image_picker
can be upgraded to use that version (without us having to explicitly depend on it)
Tried with both solutions suggested, observing the same error when trying with SPM
Hmm, since the conversation in that other issue is still ongoing (they asked for some things in a reproducible sample's iOS project to investigate further), I do suggest we turn off the image_picker
part of the example, with a link to that issue, so we can re-enable it later (for people that are using SPM).
Alright then I’ll try to figure out how to go about doing that and push the changes to the same branch.
@navaronbracke After removing the image_picker from the pubspec.yaml file in the ‘example’ directory for iOS, I’m getting this build error : Error (Xcode): Error: Couldn't resolve the package 'image_picker' in 'package:image_picker/image_picker.dart’.
I’m not able to figure out where else the image_picker is used from the universal search or going through the directories. Would appreciate any help on where to go.
AFAIK we only use it here in the example, but nowhere else in this repository: https://github.com/juliansteenbakker/mobile_scanner/blob/master/example/lib/scanner_button_widgets.dart
Perhaps doing a flutter clean
and/or cleaning the XCode build directory from within XCode itself and rebuilding the example app fixes it?
@navaronbracke The steps you suggested did work, surprised VS code didn’t find it’s usage.
I have a concern regarding disabling the use of image picker, this will affect users irrespective of whether they’re building using Cocoapods or SPM.
I’d suggest we proceed with this change once the image_picker_ios issue is resolved to prevent blocking users from utilising the feature.
I did try what you suggested and I’m getting an error 'Module ‘integration_test’ not found' now this can be resolved I believe but since I had the query wanted to confirm if it’s a good idea to proceed with this change at this time?
Perhaps you had filters on that excluded files when searching in VS Code?
I do agree, perhaps we should wait until image_picker
releases a version that depends on that image_picker_ios
version. Although, this would only affect our example app, but it is still a valid concern.
For integration_test
, that should be vendored by the Flutter SDK itself, and should be kept under the dev dependencies.
See https://docs.flutter.dev/release/breaking-changes/flutter-driver-migration#setup
I'm not sure why that would be causing a problem, though? Perhaps because integration_test itself isn't migrated to SPM? Or was it a stale build on your end?
Regarding your contribution, I would propose that you already open up the pull request as a draft. Then I can take a look at it, and you won't lose the work (as it exists on a remote then)
@navaronbracke I’m not entirely sure why integration_test is throwing the error because we already have the dev_dependency included in the pubspec.yaml. It is possible that this issue is only occurring on my system as I have set up flutter for the first time or could require a transition to SPM but from my searches online it looks to be a flutter specific dependency and not SPM or Cocoapods.
Anyways the draft PR with my changes is up and linked below : Draft PR : https://github.com/juliansteenbakker/mobile_scanner/pull/1155
You can review the changes and let me know if there’s something wrong, if you have the time I’d request you attempt to build it on your machine and see if you can reproduce the issue.
Note: Building with the SPM flag disabled works fine since it falls back to Cocoapods.
I will take a look later this week. Thanks again for working on this!
If we migrate to swift package manager, I’m encountering an error "Parse Issue (Xcode): Module 'image_picker_ios' not found” this seems to be a common issue with this module when we switch over to swift package manager.
Found an open issue in Git : flutter/flutter#152550
Hello @Xa69, you're the second person to report this problem. Unfortunately, I'm having difficulties reproducing this problem on my machine. Would you be able to share a sample project and instructions to reproduce this problem?
Hi @loic-sharma I’m not able to reproduce this as well as the build is getting stuck due to this other issue. https://github.com/juliansteenbakker/mobile_scanner/issues/953
I’m not sure what could be causing this as I’m using the latest Cocoapods however I will try to figure out how to reproduce this to help you debug further.
CC: @navaronbracke
In #953 people seem to suggest it has to do with what cocapods version you are using?
@navaronbracke 1.15.2
Also @navaronbracke this build issue regarding the ‘MLKit’ is the same as our conversation which is ongoing here https://github.com/juliansteenbakker/mobile_scanner/pull/1155.
Could you please try on your system and check if you can repro the ‘image_picker’ issue? I don’t remember any explicit steps for reproducing the issue.
Just running flutter build used to reproduce the ‘image_picker’ issue after enabling Swift package manager through the config command 'flutter config --enable-swift-package-manager’
You just need to checkout my branch 'users/nimish/1150-SPM-Support-Changes’ and try to build the example app.
I can't reproduce this on an Intel Mac, on Flutter 3.24.1, using a fresh copy of your branch.
Flutter will eventually deprecate and then remove support for CocoaPods. We should add Swift Package Manager support instead.
Migration guide here: https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors#how-to-add-swift-package-manager-support-to-an-existing-flutter-plugin
Why is Flutter migrating to Swift Package Manager?
CocoaPods is now in maintenance mode.
Swift Package Manager support is one of Flutter’s most requested features: flutter#33850.
Flutter's Swift Package Manager integration has several benefits: