stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.26k stars 260 forks source link

iOS: NSCameraUsageDescription key required even if not used / card scanning available at all? #210

Open benomatis opened 3 years ago

benomatis commented 3 years ago

Related to #167

@thorsten-stripe I just ran into this as well, I'm being asked to provide a NSCameraUsageDescription key even though I'm not using the camera in my app. However, the message is not coming during a review, so I cannot contact the review team, it's a request for me to add the key, otherwise the build won't end up in App Store Connect at all. I think we should, at the minimum, update the doc to say this key will need to be added no matter what, which this message seems to indicate. Here is the full text:

Dear Developer,

We identified one or more issues with a recent delivery for your app, "App Name" 1.2.3 (45). Please correct the following issues, then upload again.

ITMS-90683: Missing Purpose String in Info.plist - Your app's code references one or more APIs that access sensitive user data. The app's Info.plist file should contain a NSCameraUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting Spring 2019, all apps submitted to the App Store that access user data are required to include a purpose string. If you're using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. You can contact the developer of the library or SDK and request they release a version of their code that doesn't contain the APIs. Learn more (https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).

Best regards,

The App Store Team

benomatis commented 3 years ago

@thorsten-stripe as an additional question, closely related, is card scanning available at all in iOS (or Android, for that matter)? I see no reference to it in this library even though the key above is set and says "to scan cards" - I read about the feature in the Stripe iOS SDK docs.

davidme-stripe commented 3 years ago

Card scanning is built-in on iOS — if you set an NSCameraUsageDescription, it'll show a "Scan card" button in PaymentSheet.

This App Store Connect message seems overly-broad: We don't show the card scanning button unless an NSCameraUsageDescription is set, and this check makes it difficult to distribute an SDK with an optional camera feature. It looks like we'll have to split card scanning into a separate component or a compile-time option.

For now, I'd recommend setting the NSCameraUsageDescription to "To scan cards", and we'll look into a way to disable this at compile-time.

benomatis commented 3 years ago

I have only gotten this message once, when I started using this library, and I did not have the key set. I already set the key, so it's ok, but would be indeed nice if it was optional, though I saw nothing changing in the app, I thought it will ask for permission to use the camera, but it doesn't.

davidme-stripe commented 3 years ago

The "scan card" button is only in PaymentSheet at the moment, so it won't appear if you built your own card form.

benomatis commented 3 years ago

oh, ok, I'm using the card form. Is the PaymentSheet the name of the pre-built UI?

davidme-stripe commented 3 years ago

Yes. Card scanning outside of PaymentSheet is on our roadmap, but we don't have an ETA yet.

benomatis commented 3 years ago

ok, thank you. So I guess this issue could be used to prevent having to set this key if Camera is otherwise not used in the app?

On Fri, 14 May 2021 at 17:58, davidme-stripe @.***> wrote:

Yes. Card scanning outside of PaymentSheet is on our roadmap, but we don't have an ETA yet.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stripe/stripe-react-native/issues/210#issuecomment-841334518, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMNSHAAJSCVYTQJDGBDX5DTNVCDLANCNFSM442I7OGA .

davidme-stripe commented 3 years ago

Yeah, we'll leave this open to track that work.

rlam3 commented 2 years ago

@davidme-stripe thank you for your hard work. can you please give us an update on this issue? is it still open?

JuliusHuizing commented 1 year ago

Perhaps make this requirement more explicit in the stripe docs for eg implementing apple pay on ios? As a newbie to Stripe, I believe I followed the apple pay implementation docs step by step but did not notice this as a requirement.

In general, this is very unexpected to me and it took me a few hours to find the issue because I make no use of the camera and apple does not specify the package that triggers the error. Just happy I stumbled upon this thread relatively quickly…

zyaanbookee commented 1 year ago

If using expo, I resolved this issue by adding in app.json { "expo": { "ios": { "infoPlist": { "NSCameraUsageDescription": "This app uses camera to scan." }, }, }, }