gibt es keinen Fehler, aber wenn ich es am realen Telefon testen, auch in der Simulation, zeigt es nur ein Schloss Bild und "Diese App hat keinen Zugriff auf Ihre Fotos oder Videos, die Sie in den Datenschutzeinstellungen aktivieren können "aber wenn ich mich an die Einstellung wende, konnte ich meine App nicht in den Datenschutzeinstellungen finden. Was habe ich falsch gemacht?Warum kann ich nicht zugreifen Foto Bibliothek mit UIImagePickerController
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if indexPath.row == 0 {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.allowsEditing = false
let selectedSourceAction = UIAlertController(title: "What source do you want to access?", message: "", preferredStyle: UIAlertControllerStyle.ActionSheet)
let fromPhotoLibrary = UIAlertAction(title: "Photo Library", style: UIAlertActionStyle.Default, handler: {(action: UIAlertAction!) -> Void in
imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
self.presentViewController(imagePicker, animated: true, completion: nil)
})
let fromCamera = UIAlertAction(title: "Camera", style: UIAlertActionStyle.Default, handler: {(action: UIAlertAction!) -> Void in
imagePicker.sourceType = UIImagePickerControllerSourceType.Camera
self.presentViewController(imagePicker, animated: true, completion: nil)
})
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
selectedSourceAction.addAction(fromPhotoLibrary)
selectedSourceAction.addAction(fromCamera)
selectedSourceAction.addAction(cancelAction)
self.presentViewController(selectedSourceAction, animated: true, completion: nil)
}
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
imageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage
imageView.contentMode = UIViewContentMode.ScaleAspectFit
imageView.clipsToBounds = true
dismissViewControllerAnimated(true, completion: nil)
}
Gehen Sie zu Einstellungen -> Datenschutz ---> Fotos ---> Fotos in Ihrer App aktivieren – Maddy
@Maddy nein, es hat mich nicht alarmiert, wenn ich ablehnen oder es akzeptieren möchte Zugriff auf mein Foto beim ersten Öffnen Meine App, und ich konnte meine App nicht finden, was gerade in der Privatsphäre App Liste –
@Maddy installiert, aber ich ein anderes Projekt erstellen und den gleichen Code eingeben, es funktioniert gut, ich denke, es kann auf meinem eigenen Projekt schief gehen –