mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 463 forks source link

iOS example problem #156

Closed JakobStadlhuber closed 4 years ago

JakobStadlhuber commented 4 years ago

I tried the example without changes on iOS but it did not run. On Android it works fine. Other iOS Apps on flutter works also fine.

Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                            2,1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    error: Multiple commands produce '/Users/jakob/Downloads/flutter_barcode_reader-master/example/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
    1) Target 'Runner' has copy command from '/Users/jakob/Downloads/flutter_barcode_reader-master/example/ios/Flutter/Flutter.framework' to '/Users/jakob/Downloads/flutter_barcode_reader-master/example/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
    2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
    note: Using new build systemnote: Planning buildnote: Constructing build descriptionwarning: duplicate output file '/Users/jakob/Downloads/flutter_barcode_reader-master/example/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/jakob/Library/Developer/Xcode/DerivedData/Runner-cxqwghcvmizreufqmpetnzcxveiq/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-9B898C697EA984FE43747B57.sh (in target 'Runner' from project 'Runner')

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
HannHank commented 4 years ago

Do you followed the Instructions for IOS ?

image

JakobStadlhuber commented 4 years ago

Yes I did.

If try the Xcode runner I also get a error:


Multiple commands produce '/Users/jakob/Library/Developer/Xcode/DerivedData/Runner-cxqwghcvmizreufqmpetnzcxveiq/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
1) Target 'Runner' has copy command from '/Users/jakob/Downloads/flutter_barcode_reader-master/example/ios/Flutter/Flutter.framework' to '/Users/jakob/Library/Developer/Xcode/DerivedData/Runner-cxqwghcvmizreufqmpetnzcxveiq/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
HannHank commented 4 years ago

Mhhm I am also not a pro in Flutter, but after a short research, I found that fix: https://github.com/flutter/flutter/issues/20685#issuecomment-413524718 maybe this also could work for you.

JakobStadlhuber commented 4 years ago

Thanks @HannHank I can deploy it now. One last problem: "The user did not grant the camera permissions!" I added this:

NSCameraUsageDescription Camera permission is required for barcode scanning.

but it is still not working, can I manually add permissions or how can I fix it?

HannHank commented 4 years ago

Mhhm normally you add the permission as I mentioned before. I am not very familiar to ios, but I guess you can add camera permission manually in the ios settings ? There must be a toggle switch to allow your flutter app the usage of the camera

JoshRice1 commented 4 years ago

I am having the same issue on iOS something is amiss with the permissions. It should be prompting for permission before displaying the error?

JakobStadlhuber commented 4 years ago

yea exactly there is no prompting. thats strange.

HannHank commented 4 years ago

Can you set the app permission in the ios settings ?

JoshRice1 commented 4 years ago

OK so did a little more playing this morning and figured a couple of things out. One, on the simulator I was unable to get this to work. I believe that is because there is no camera support. On a physical device, I had to set up signing for the debug build than I started to get prompted. You might want to make a note about the simulator.

HannHank commented 4 years ago

Okay that is interesting, because if you are using an Android simulator you where also prompted. So it seems that just ios Simulator don't work with camera usage. So the issue can be closed ?

devtronic commented 4 years ago

You have to use the legacy build system. (Xcode: Files-> Project/Workspace Settings -> Build system)