Open ly918 opened 5 years ago
Thanks for reporting the issue. Have you followed the Readme section to use the plugin? Can you add some error logs?
I also had the same problem. I still couldn't solve it. I followed all the documentation steps
@Viktoorrocha this error mainly occurs when the iOS part isn't created in swift.
By default flutter creates iOS code in objective c. This plugin is written in swift so it requires iOS project to be created in swift. Some possible reasons are due to plugin not linked correctly, which can be resolved by flutter clean
and reinstalling app.
I also have the same problem
@huanglong6828 Thanks for using the plugin. Just to confirm that, is your iOS part is created in Swift? Or is it in Objective C?
@AmolGangadhare Thanks Reply I created the project according to Flutter's process. It was changed to 10 in the Runner. The swift version setting was not found in Xcode. The version in the terminal is version 5.
@huanglong6828 By default flutter creates Android part in Java and iOS part in Objective C. For iOS, the plugin is written in Swift so it requires iOS project in swift. Please create a new project with Swift support to iOS or just follow steps provided in README.
Please acknowledge the issue if it is solved or not
@AmolGangadhare Thanks, I am trying to convert to Swift.
@AmolGangadhare Thank you for providing such a great plugin that you can use successfully.
@huanglong6828 Great. Did you face any other issues while using the plugin?
@AmolGangadhare No other questions
I also have the same problem
@Viktoorrocha this error mainly occurs when the iOS part isn't created in swift. By default flutter creates iOS code in objective c. This plugin is written in swift so it requires iOS project to be created in swift. Some possible reasons are due to plugin not linked correctly, which can be resolved by
flutter clean
and reinstalling app.
I tried your solution. And he returned me:
Launching lib/main.dart on iPhone 7 in debug mode... Expected ios/Runner.xcodeproj but this file is missing. No application found for TargetPlatform.ios. Is your project missing an ios/Runner/Info.plist? Consider running "flutter create ." to create one.
'flutter_barcode_scanner/flutter_barcode_scanner-Swift.h' file not found
it still error
By default, flutter creates Android part in Java and iOS part in Objective C. For iOS, the plugin is written in Swift so it requires iOS project in swift. Please create a new project with Swift support to iOS or just follow steps provided in README.
Runner.xcodeproj
with Xcode;Runner
in the Project Navigator on the left, and click New File
;Create Bridging Header
and do not remove Swift file then;#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
with #import <flutter_barcode_scanner-Swift.h>
;
- Open
Runner.xcodeproj
with Xcode;- Right-click on
Runner
in the Project Navigator on the left, and clickNew File
;- Create a single empty Swift file to the project;
- When Xcode asks, press
Create Bridging Header
and do not remove Swift file then;- Edit .m file, replace
#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
with#import <flutter_barcode_scanner-Swift.h>
;- Re-run.
Sorry, but can you explain from the step 5? what happen after we create new swift file? copy paste .m file? i dont understand
I just got it working fine. For newbie that do not understand the docs/README, follow this step:
flutter create -i swift .
Runner.xcodeproj
用Xcode 打开;Runner
在左侧的Project Navigator中右键单击,然后单击New File
;- 为项目创建一个空的Swift文件;
- 当Xcode问,按,然后
Create Bridging Header
不删除Swift文件;- 编辑.m文件,替换
#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
为#import <flutter_barcode_scanner-Swift.h>
;- 重新运行。
Good job, It's work!
I updated lib but I still get the same error: BUILD FAILED
Xcode's output: ↳ === BUILD TARGET sqflite OF PROJECT Pods WITH CONFIGURATION Debug === /Users/sescti/.pub-cache/hosted/pub.dartlang.org/flutter_barcode_scanner-0.1.7/ios/Classes/FlutterBarcodeScannerPlugin.m:2:9: fatal error: 'flutter_barcode_scanner/flutter_barcode_scanner-Swift.h' file not found
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:35:11: warning: variable 'originRect' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:43:26: note: uninitialized use occurs here
atSource:originRect];
^~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:35:7: note: remove the 'if' if its condition is always true
if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:35:11: warning: variable 'originRect' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:43:26: note: uninitialized use occurs here
atSource:originRect];
^~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:35:11: note: remove the '&&' if its condition is always true
if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:35:11: warning: variable 'originRect' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:43:26: note: uninitialized use occurs here
atSource:originRect];
^~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:35:11: note: remove the '&&' if its condition is always true
if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:35:11: warning: variable 'originRect' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
^~~~~~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:43:26: note: uninitialized use occurs here
atSource:originRect];
^~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:35:11: note: remove the '&&' if its condition is always true
if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) {
^~~~~~~~~~~~~~~~~
/Users/sescti/.pub-cache/hosted/pub.dartlang.org/share-0.6.2+1/ios/Classes/SharePlugin.m:34:7: note: variable 'originRect' is declared here
CGRect originRect;
^
4 warnings generated.
Could not build the application for the simulator. Error launching application on iPhone 8.
Try pod install
the plugin might not have downloaded. Then open project using .xcworkspace
Facing the same issue. I am using Swift for my iOS part by default
I just got it working fine. For newbie that do not understand the docs/README, follow this step:
- Go to your flutter project and delete the ios folder
- Then run flutter
flutter create -i swift .
- Then you just re run your project.
this was the only comment that worked for me
- Open
Runner.xcodeproj
with Xcode;- Right-click on
Runner
in the Project Navigator on the left, and clickNew File
;- Create a single empty Swift file to the project;
- When Xcode asks, press
Create Bridging Header
and do not remove Swift file then;- Edit .m file, replace
#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
with#import <flutter_barcode_scanner-Swift.h>
;- Re-run.
Just STEP 5 was sufficient for me!
same issue. was working perfectly after upgrade. such annoying erors different on vscode run part and xcode run part.
- Open
Runner.xcodeproj
with Xcode;- Right-click on
Runner
in the Project Navigator on the left, and clickNew File
;- Create a single empty Swift file to the project;
- When Xcode asks, press
Create Bridging Header
and do not remove Swift file then;- Edit .m file, replace
#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
with#import <flutter_barcode_scanner-Swift.h>
;- Re-run. @markqq
- What do I name the empty file?
- Xcode never asks me.
- How do I replace something I never keyed in? Can you explain more? Thanks.
- Open
Runner.xcodeproj
with Xcode;- Right-click on
Runner
in the Project Navigator on the left, and clickNew File
;- Create a single empty Swift file to the project;
- When Xcode asks, press
Create Bridging Header
and do not remove Swift file then;- Edit .m file, replace
#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
with#import <flutter_barcode_scanner-Swift.h>
;- Re-run. @markqq
- What do I name the empty file?
- Xcode never asks me.
- How do I replace something I never keyed in? Can you explain more? Thanks.
Did you make it work? Nothing helped me and looks like this issue will stay for a long time...
Having the same issue, and not able to resolve so far with these solutions.
I think the solution it's to use other packege.
@paulewetzel I went with @rodrigofbm's idea. I am using barcode_scan.
same h
@paulewetzel I went with @rodrigofbm's idea. I am using barcode_scan.
same here. maintened plugin is very importan.
Me too.
On Sat, May 16, 2020 at 6:25 PM Xgamefactory notifications@github.com wrote:
same h
@paulewetzel https://github.com/paulewetzel I went with @rodrigofbm https://github.com/rodrigofbm's idea. I am using barcode_scan.
same here. maintened plugin is very importan.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AmolGangadhare/flutter_barcode_scanner/issues/28#issuecomment-629728811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG26KZFB6STLQLKSBQ4BNLRR44JZANCNFSM4IKGVYBQ .
I have one query here... As we are building or run the app, we can change the header easily but how to make changes when there is CI/CD pipeline in case of building and deploying a flutter project.
When building from XCode:
<unknown>:0: error: module map file '/my-app-folder/build/ios/Debug-iphonesimulator/flutter_barcode_scanner/flutter_barcode_scanner.modulemap' not found
Plenty of these errors. Maybe the plugin has been exported with this modulemap file missing? Just asking, I don't know how to create flutter libs.
Same error here. Already recreate the project as swift, done steps on the read me, no success. Anyone can help?
Still facing the error. How to resolve? Anyone solved yet?
Hi @rifat-22 , Which issue you are referring to here.
Hello @Harshdeep4295, this issue fatal error: 'flutter_barcode_scanner/flutter_barcode_scanner-Swift.h' file not found
HI @rifat-22 , there is this manual solution for now, which I was able to work with. It is https://github.com/AmolGangadhare/flutter_barcode_scanner/issues/28#issuecomment-595749195 this one only. Try this, hope this will work.
Hi @Harshdeep4295 thanks for your response and I have these https://github.com/AmolGangadhare/flutter_barcode_scanner/issues/28#issuecomment-624425666 quires, can you help ?
Hi @rifat-22 , Have you tried using below
Edit .m file, replace #import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h> with #import
if you can see this pod project, just try importing flutter_barcode_scanner.h or flutter_barcode_scanner-Swift.h directly..
Hello @Harshdeep4295 , I have edited the .m file then I am facing this error
It should be noted that you need to open your project via the ios/Runner.xcworkspace and NOT the ios/Runner.xcodeproj, I was having this issue and it was because I was running the xcodeproj and not the xcworksapce...
- Open
Runner.xcodeproj
with Xcode;- Right-click on
Runner
in the Project Navigator on the left, and clickNew File
;- Create a single empty Swift file to the project;
- When Xcode asks, press
Create Bridging Header
and do not remove Swift file then;- Edit .m file, replace
#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
with#import <flutter_barcode_scanner-Swift.h>
;- Re-run.
It works for me
- Open
Runner.xcodeproj
with Xcode;- Right-click on
Runner
in the Project Navigator on the left, and clickNew File
;- Create a single empty Swift file to the project;
- When Xcode asks, press
Create Bridging Header
and do not remove Swift file then;- Edit .m file, replace
#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
with#import <flutter_barcode_scanner-Swift.h>
;- Re-run.
It works for me
for one project it worked perfectly and for another project its not working
- Open
Runner.xcodeproj
with Xcode;- Right-click on
Runner
in the Project Navigator on the left, and clickNew File
;- Create a single empty Swift file to the project;
- When Xcode asks, press
Create Bridging Header
and do not remove Swift file then;- Edit .m file, replace
#import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h>
with#import <flutter_barcode_scanner-Swift.h>
;- Re-run.
This works for me. I just need to do step 5. Thumbs up.
replace #import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h> with #import
open xcode and check and replace this import line, its worked for me.
replace #import <flutter_barcode_scanner/flutter_barcode_scanner-Swift.h> with #import
open xcode and check and replace this import line, its worked for m
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.