Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

UIImagePickerControllerOriginalImage #13

Open
sehyunchung opened this issue Jun 29, 2020 · 0 comments
Open

UIImagePickerControllerOriginalImage #13

sehyunchung opened this issue Jun 29, 2020 · 0 comments

Comments

@sehyunchung
Copy link
Owner

sehyunchung commented Jun 29, 2020

FoodTracker 예제 중 Work with View Controllers 튜토리얼에 버그... 는 아니고 옛날 자료라서 지금 안돌아가는 게 있었다.

링크를 찾아 아래와 같이 해결

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

        // The info dictionary may contain multiple representations of the image. You want to use the original.
-        guard let selectedImage = info[UIImagePickerControllerOriginalImage] as? UIImage else {
+        guard let selectedImage = info[.originalImage] as? UIImage else {
            fatalError("Expected a dictionary containing as image, but was provided the following: \(info)")
        }

        // Set photoImageView to display the selected image.
        photoImageView.image = selectedImage

        // Dismiss the picker.
        dismiss(animated: true, completion: nil)
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant