Vous essayez de suivre le didacticiel Apple FoodTracker. xCode 8.1. Je reçois ce crashlog:La clé NSPhotoLibraryUsageDescription a été ajoutée à info.plist, se bloque toujours en raison de données confidentielles sensibles
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.
(LLDB)
J'ai lu plusieurs messages sur les disparus clés de confidentialité dans iOS 10, et donc j'ajouté la clé nécessaire ...
Confidentialité - Photothèque Utilisation Description
... et un message personnalisé sous la colonne de valeur. Pourtant, je reçois toujours le même accident quand je tape sur l'image. Toute aide est la bienvenue. J'aimerais finir ce tutoriel.
Merci!
INFO:
Je ne peux pas inclure une capture d'écran de mon info.plist encore, alors voici le lien vers une capture d'écran:
Voici mon ViewController.swift juste au cas où:
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"
}
}
Je suis en train de faire aussi le tutoriel et je suis à la section avec le sélecteur d'image. Tout fonctionne pour moi après avoir ajouté la clé de confidentialité. Peut-être qu'il va vous aider https://github.com/ronatory/food-tracker – ronatory