gpt4 book ai didi

ios - NSPhotoLibraryUsageDescription 键添加到 info.plist,由于隐私敏感数据仍然崩溃

转载 作者:行者123 更新时间:2023-11-28 08:24:32 37 4
gpt4 key购买 nike

尝试遵循 FoodTracker Apple 教程。代码 8.1。我得到这个崩溃日志:

2016-11-06 16:49:17.922832 FoodTracker[2307:660318] [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 NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

(数据库)

我已经阅读了几篇关于 iOS 10 中缺少隐私 key 的文章,因此我添加了所需的 key ...

隐私 - 照片库使用说明

...以及值列下的自定义消息。然而,当我点击图像时,我仍然遇到同样的崩溃。任何帮助都会很棒。我很想完成本教程。

谢谢!

信息:

我还不能包括我的 info.plist 的截图,所以这里是截图的链接:

screenshot of info.plist

这是我的 ViewController.swift 以防万一:

import UIKit

class ViewController: UIViewController, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

// MARK: Properties

@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var mealNameLabel: UILabel!
@IBOutlet weak var photoImageView: UIImageView!

override func viewDidLoad() {
super.viewDidLoad()

nameTextField.delegate = self
}

// MARK: UITextFieldDelegate
func textFieldShouldReturn(_ textField: UITextField) -> Bool {

// Hide the keyboard
textField.resignFirstResponder()

return true
}

func textFieldDidEndEditing(_ textField: UITextField) {

mealNameLabel.text = textField.text
}

// MARK: UIImageControllerDelegate
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {

dismiss(animated: true, completion: (nil))
}

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
photoImageView.image = selectedImage
dismiss(animated: true, completion: (nil))
}

// MARK: Actions
@IBAction func selectImageFromPhotoLibrary(_ sender: UITapGestureRecognizer) {

nameTextField.resignFirstResponder()
let imagePickerController = UIImagePickerController()
imagePickerController.sourceType = .photoLibrary
imagePickerController.delegate = self
present(imagePickerController, animated: true, completion: nil)
}

@IBAction func setDefaultLabelText(_ sender: UIButton) {

mealNameLabel.text = "Default Text"
}
}

最佳答案

FoodTracker项目下共有3个Info.plist文件。确保您正在编辑“FoodTracker”文件夹下的那个。此外,请确保该属性未在任何现有数组属性下级联。

关于ios - NSPhotoLibraryUsageDescription 键添加到 info.plist,由于隐私敏感数据仍然崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40454993/

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