iOS 10 App has crashed because it attempted to access privacy-sensitive data
Asked Answered
I

5

34

I'm running my project which was working fine previously but after updating my xcode my app crashes and giving this error:

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data

Inwrap answered 3/10, 2016 at 5:23 Comment(1)
Anbu.Karthik answer right.Randell
F
43

Privacy Settings in iOS 10

A significant change in iOS 10 is that you must declare ahead of time any access to private data or your App will crash.

Once you link with iOS 10 you must declare access to any user private data types. You do this by adding a usage key to your app’s Info.plist together with a purpose string. The list of frameworks that count as private data is a long one

Contacts, Calendar, Reminders, Photos, Bluetooth Sharing, Microphone, Camera, Location, Health, HomeKit, Media Library, Motion, CallKit, Speech Recognition, SiriKit, TV Provider.

You need to put the NSCameraUsageDescription in your plist.

Like

<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) uses Cameras</string>

for e.g

enter image description here

Check all the usage descriptions here.

Flowing answered 3/10, 2016 at 5:25 Comment(0)
P
5

I solved this problem on my simulator by adding the following entry in the info.plist

enter image description here

I havent tried above on real device using camera, I think for that you have to enter the following value as well,

enter image description here

I am using iOS 10.2

Pictor answered 16/9, 2017 at 13:2 Comment(0)
S
5

@Anbu's answer has an extra space which throws an exception. The Info.plist entry should look as follows

<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) uses camera</string>
Symbol answered 10/1, 2019 at 16:17 Comment(0)
I
2

My won't even prompt me. I inserted the SKAdNetworkItems key, and NSUserTrackingUsageDescription key. I also have multiple info.plist for localization which all of them I updated with the keys.

I ran ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in function and it's crashing. Crash log says: "This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSUserTrackingUsageDescription key with a string value explaining to the user how the app uses this data."

But I never received a prompt asking for tracking permission

    extension ViewController: GADFullScreenContentDelegate {
  func loadVideoAd() {
    func load(){
        let request = GADRequest()
        GADInterstitialAd.load(withAdUnitID: GoogleAdKeys.Interstitial, request: request, completionHandler: { ad, error in
            if let error = error {
                print("Failed to load interstitial ad with error: \(error.localizedDescription)")
                return
            }
            self.interstitial = ad!
            self.interstitial.fullScreenContentDelegate = self
        })
    }
    
    if #available(iOS 14, *) {
      ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
        switch status{
        case .notDetermined:
          break
        case .restricted:
          break
        case .denied:
          break
        case .authorized:
          load()
        @unknown default:
          break
        }
      })
    } else {
      // Fallback on earlier versions
      load()
    }
  }

    func playVideoAd() { 
        interstitial.present(fromRootViewController: self)
    }
}
Irruption answered 28/2, 2021 at 4:2 Comment(1)
I'm having the same issue, have you found a soloution?Irruption
A
0

The new Privacy settings that are required if you build your apps with the iOS 10 SDK.A “Purpose String” MUST be provided in your Info.plist file if you’re accessing any of the privacy sensitive data.

A “Purpose String” is just a message explaining why does the app need to access that specific service that will be displayed to the user when requesting permission (just like we’re doing for the Location services since iOS 8). Not providing this “Purpose String” may cause your app to crash.

Aretha answered 3/10, 2016 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.