Receiving this error 'EXC_BREAKPOINT (code=1, subcode=0x1051904b8)' when trying to use a PhotoPicker.

I'm going insane over this, I'm using Xcode 13 beta 6 on the M1 MacBook Air. Every time I pick an image, I receive this error message. At this point I don't know what I can do because the message is so vague. Please help me.


    @Binding var image: UIImage

    

    func makeUIViewController(context: Context) -> UIImagePickerController {

        let imagePicker = UIImagePickerController()

        imagePicker.delegate = context.coordinator

        return imagePicker

    }

    

    func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {

        

    }

    

    func makeCoordinator() -> Coordinator {

        Coordinator(parent: self)

    }

    

    final class Coordinator: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

        

         var parent: PhotoPicker

        

        init(parent: PhotoPicker){

            self.parent = parent

        }

        

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

            if let image = info[.originalImage] as? UIImage {

                parent.image = image

            }else{

                

            }

            picker.dismiss(animated: true, completion: nil)

        }

    }

}

    

    @State private var isPresented: Bool = false

    @State private var avatarImage = UIImage(systemName: "person") ?? UIImage()

    

    var body: some View {

        VStack {

            Image(uiImage: avatarImage)

                .resizable()

                .scaledToFill()

                .frame(width: 150, height: 150)

                .clipShape(Circle())

                .padding()

                .onTapGesture {

                    isPresented = true

                }

            

            Spacer()

        }

        .navigationTitle("Profile")

        .sheet(isPresented: $isPresented) {

            PhotoPicker(image: $avatarImage)

        }

    }

}

Did you ever solve this, I am struggling with almost exact issue. I have an Image display in ContentView very similar to yours!

If you run the app outside of Xcode, does it fail there as well? If so, does that generate a crash report. If so, please it here. See Posting a Crash Report for advice on how to do that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Did you figure this out? I am having a very similar problem, also on M1. It is also driving me crazy. I tried to copy your code snippets to reproduce yours, but not enough there.

I did generate a crash report.

Cool.

Here is crash report

I can’t read that )-: Please post it again, this time following the instructions in Posting a Crash Report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Receiving this error 'EXC_BREAKPOINT (code=1, subcode=0x1051904b8)' when trying to use a PhotoPicker.
 
 
Q