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 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.

Add a Comment

Replies

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"

  • I did generate a crash report. App crashes on first run, next run it runs fine. Here is crash report, I can't really make sense of it....

    Translated Report (Full Report Below)

    Process: PictureWindow [5133] Path: /Volumes/VOLUME/*/PictureWindow.app/Contents/MacOS/PictureWindow Identifier: au.com.egads.PictureWindow Version: 4.0 (2) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 502

    Date/Time: 2022-05-20 11:56:40.6344 -0600 OS Version: macOS 12.3.1 (21E258) Report Version: 12 Anonymous UUID: 7EB4221B-BF57-A176-EE89-F261FF81DA97

    Time Awake Since Boot: 14000 seconds

    System Integrity Protection: enabled

    Crashed Thread: 0 Dispatch queue: com.apple.main-thread

    Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000018c942158 Exception Note: EXC_CORPSE_NOTIFY

    Termination Reason: Namespace SIGNAL, Code 5 Trace/BPT trap: 5 Terminating Process: exc handler [5133]

    Application Specific Information: Secure coding for state restoration requested after it was initialized without. NSApplicationDelegate was probably established too late.

    had to delete the rest, too long for this forum, Is there a way I could send it to you?
  • The above was run outside of Xcode, I generated an archive to distribute to team for test.

Add a Comment

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"