Hi guys,
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.
Could you help me?
Thanks in advance
You need to add that in xCode - you can write a PostProcessBuild function in a editor script that will add those automatically to the info.plist for you (so it works on a cloud build).
Here’s an example:
using UnityEngine;
using UnityEditor;
#if UNITY_IPHONE
using UnityEditor.iOS.Xcode;
#endif
using UnityEditor.Callbacks;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System;
#if UNITY_IPHONE
using PlistCS;
#endif
public class CloudPostBuild : MonoBehaviour
{
public static void ModifyPList( string buildPath )
{
#if UNITY_IPHONE
string plistPath = Path.Combine( buildPath , "Info.plist" );
if( !File.Exists( plistPath ) )
{
UnityEngine.Debug.LogWarning("Couldn't find Info.plist in build output.");
return;
}
// modify plist
Dictionary<string,object> plist = (Dictionary<string,object>) Plist.readPlist(plistPath);
plist["NSPhotoLibraryUsageDescription"] = "Prime31 Plugin - not used in the app";
plist["NSCameraUsageDescription"] = "Prime31 Plugin - not used in the app";
Plist.writeXml(plist, plistPath);
#endif
}
[PostProcessBuild]
public static void OnPostprocessBuild( BuildTarget bt , string path )
{
#if UNITY_IPHONE
ModifyPList( path );
UnityEngine.Debug.Log( "Post process Cloud Settings to xCode" );
#endif
}
}
Hi tonemcbride, thanks for your reply.
That solved my issue.
Thank you very much!