I’m using Unity 5.5.0 f3 with Vuforia on Windows 10. I’m using the Unity Cloud to build for iOS.
When I try to test the app in my ipad it crashes and this is what appears in the log.
Termination Reason: TCC, 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.
I can’t find where to add the permission. If I have to do it in the Unity Editor or in the Unity Cloud.
You will need to modify the Info.plist in a post-export step (either using PostProcessBuildAttribute or configuring a custom post-export method in your Unity Cloud Build target configuration).
Here is an example of how you would add that value at build time using a PostProcessBuildAttribute (which should work both locally and in UCB):
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using System.IO;
using System.Collections.Generic;
public class CloudBuildHelper : MonoBehaviour
{
#if UNITY_IOS
[PostProcessBuild]
static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
// Read plist
var plistPath = Path.Combine(path, "Info.plist");
var plist = new PlistDocument();
plist.ReadFromFile(plistPath);
// Update value
PlistElementDict rootDict = plist.root;
rootDict.SetString("NSCameraUsageDescription", "Used for taking selfies");
// Write plist
File.WriteAllText(plistPath, plist.WriteToString());
}
#endif
}
Note that script will need to be in an Editor/ folder inside your project.
@dannyd I’m using the localization package 1.3.2 and it seems that it’s still required to manually add the NSCameraUsageDescription key to the info.plist.
When will this be part of the process automatically? I mean why am I creating the translations for the camera when they are not added automatically?
Have you tried 1.4.3? If it’s not visible in the package manager you may need to edit the manfiest.json file in the packages folder. If this is still an issue please file a bug report so we can look into it.
I am getting rejected because of this in Unity 2023.1.10
Is there a solution?
I only use the mic, but if I leave out the camera description in the Unity build it crashes on device testing in Testflight because
“exception” : {“codes”:“0x0000000000000000, 0x0000000000000000”,“rawCodes”:[0,0],“type”:“EXC_CRASH”,“signal”:“SIGABRT”},
“termination” : {“flags”:518,“code”:0,“namespace”:“TCC”,“details”:[“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.”]},
“faultingThread” : 2,
“threads” : [{“id”:143565,“queue”:"com.apple.main-
If I fill in the Camera description with something like "Camera not used’ it runs fine on Testflight, but then gets rejected by the appstore review team for a privacy violation for not explaining what the camera is used for.
They’re not interested it’s a Unity bug/issue.
I notice in the XCode project classes/Unity CameraCapture is included but I don’t use Camera at all.