Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silent failure when no Camera Usage Description in info.plist. #53

Open
ghost opened this issue Nov 20, 2018 · 4 comments
Open

Silent failure when no Camera Usage Description in info.plist. #53

ghost opened this issue Nov 20, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Nov 20, 2018

Create a new flutter project using example as main.dart. Getting only black screen on iPhone7.

However, running example in your plug-in project works. I'm assuming it's an invalid programmer at keyboard error, but is there additional set up I need to do? Any clues?

Using pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  qr_mobile_vision: ^0.1.0
@rmtmckenzie
Copy link
Owner

That should be enough to get it going, so I'm not really sure what's going on. You've copied https://github.com/rmtmckenzie/flutter_qr_mobile_vision/blob/master/example/lib/main.dart exactly, and run flutter packages get?

The only other things I can think of are running pod install in the ios folder, or opening the xcode project and running from there.

@rmtmckenzie
Copy link
Owner

I just realized what the problem is. You need to set a particular string in the ios/Runner/info.plist stating what you're going to use the camera for, otherwise iOS fails pretty much silently when you try to use the camera API. It should have been returning some sort of platform exception, although when I tried it it didn't the first time. If I tried opening and closing the camera a few times it started showing the exception then.

Either open the Info.plist in xcode and add the Privacy - Camera Usage Description key with something like 'Scan QR Codes' or

<key>NSCameraUsageDescriptoin</key>
<string>Scan QR Codes.</string>

to the Info.plist directly using whichever editor.

@rmtmckenzie rmtmckenzie changed the title Example failing on iPhone7 Silent failure when no Camera Usage Description in info.plist. Nov 20, 2018
@rmtmckenzie
Copy link
Owner

rmtmckenzie commented Nov 20, 2018

I'm going to leave this issue open as a TODO for myself (and I've changed the title). I need to at least document this in the README for this repo, or return a better error (or possibly even check the info.plist myself and fail earlier).

@ghost
Copy link
Author

ghost commented Nov 20, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant