Socialcademy: Unable to click "Use Photo"

Hi there, I’ve a problem with the SocialCademy app. When I want to choose retake or use photo to change the profile picture, I can’t press the button. It seems to come from the .fullScreenCover when using camera, or Firestore Storage ?

I tried with the source of the project, same problem. Any idea ? Anyone got this problem ?

Thanks

Xcode 13.4, iPhone SE 2 15.5

Edit:

I’m still blocked… After setting breakpoints, this is the last code which is executed before freezing.

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
guard let imageURL = info[UIImagePickerController.InfoKey.imageURL] as? URL else { return }
view.onSelect(imageURL)
view.dismiss()
}

I also have this problem and I also didn’t figured out how to fix it :frowning:
So that by this reply I just highlight existence of this problem :confused:

I got a solution. The problem is that we can’t get imageURL if it doesn’t exist, so it’s freezing…

My code does:
1/ set name of image taken by camera
2/ set a temp dir to save the image
3/ set the local path of the image
4/ set the data (image) in jpeg, compression: 0.3 (set it to 0.5 or 1.0…depends the quality you want)
5/ save the data (imageName.jpeg)
6/ get the URL of the imageName.jpeg

Below the part of ImagePickerButton.swift with code commented:

// MARK: - ImagePickerCoordinator

extension ImagePickerButton {
class ImagePickerCoordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
var view: ImagePickerView

    init(view: ImagePickerView) {
        self.view = view
    }

    func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
        view.dismiss()
    }

    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
        var selectedImage: UIImage!
        var imageURL: URL!

        if let image = info[UIImagePickerController.InfoKey.editedImage] as? UIImage {
            selectedImage = image
        } else if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
            selectedImage = image
        }
         // when image comes from camera
        if picker.sourceType == UIImagePickerController.SourceType.camera {
            let imgName = "\(UUID().uuidString).jpeg" // name the pic from camera
            let documentDirectory = NSTemporaryDirectory() // Temp dir where the pic will be saved
            let localPath = documentDirectory.appending(imgName)
            let data = selectedImage.jpegData(compressionQuality: 0.3)! as NSData
            data.write(toFile: localPath, atomically: true) // save the pic
            imageURL = URL.init(fileURLWithPath: localPath) // get the pic URL
            
            // When image is choosen from library
        } else if let selectedImageURL = info[UIImagePickerController.InfoKey.imageURL] as? URL {
            imageURL = selectedImageURL
        }
        view.onSelect(imageURL)
        view.dismiss()
    }
}

}

Tell me it works for you, I don’t think this is the best solution but… this is the only one I got :slight_smile: