gpt4 book ai didi

ios - Unity Prime31 照片提示在 iOS 10 和 XCode 8 上崩溃

转载 作者:行者123 更新时间:2023-12-01 20:00:46 24 4
gpt4 key购买 nike

调用 EtceteraBinding.promptForPhoto 导致 iOS 10 立即崩溃。

public void TakePhotoTapped() {

#if UNITY_IOS
EtceteraBinding.promptForPhoto(0.2f, PhotoPromptType.Camera, 0.8f, true);
#endif

}

Xcode 吐出这个日志。它看起来确实像某种权限问题?请帮忙。
2016-10-11 11:46:35.758167 xxx[1643:458841] invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
2016-10-11 11:46:49.760643 xxx[1643:458841] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2016-10-11 11:46:49.768609 xxx[1643:458841] [MC] Reading from public effective user settings.
2016-10-11 11:47:02.450381 xxx[1643:459135] [access] 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.

最佳答案

这与新的 iOS 10 隐私设置要求有关。您必须提前声明对私有(private)数据的任何访问权限,否则您的应用程序将崩溃。

您可以将使用 key 与目的字符串一起添加到应用程序的 Info.plist,或者添加一个脚本,在 Unity 中为您的所有构建执行此操作。

Xcode Info.plist 选项卡:
Info.plist

因此,对于每个框架,您必须声明它的用途并输入显示给用户的字符串消息。

您还可以在 Assets/Editor 文件夹中添加后处理脚本,在其中声明使用的所有功能 - 这将自动将它们添加到 Info.plist:

using UnityEngine;
using UnityEditor;
using System.Collections;
using UnityEditor.Callbacks;
using System.Collections;
using System.IO;
using UnityEditor.iOS.Xcode;


public class ChangeIOSplistFile : MonoBehaviour {

[PostProcessBuild]
public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject) {

if (buildTarget == BuildTarget.iOS) {

// Get plist
string plistPath = pathToBuiltProject + "/Info.plist";
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));

// Get root
PlistElementDict rootDict = plist.root;
var cameraKey = "NSCameraUsageDescription";
rootDict.CreateDict (cameraKey);
rootDict.SetString (cameraKey, "Enter your description here.");

var galleryKey = "NSPhotoLibraryUsageDescription";
rootDict.CreateDict (galleryKey);

rootDict.SetString (galleryKey, "Enter your description here.");

// Write to file
File.WriteAllText(plistPath, plist.WriteToString());
}
}
}

关于ios - Unity Prime31 照片提示在 iOS 10 和 XCode 8 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39975320/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com