WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

Project 10 challenge 2. Need a bit of help! Capturing error message [Camera] fail to read exposureBiasesByMode dictionary: Error

Forums > 100 Days of Swift

Hi guys I'm kind of confused regading that return value for "UIImagePickerController.isSourceTypeAvailable()" were do we need to declare this method? my camarea works perfectly fine but I'm capturing an error message in my debug console which is this:

Did someone solve this issue if yes can you guys help me out a bit? Thanks This error is captured after I tap the "Add" button.

<UIImagePickerController: 0x14a011800> 2021-05-22 21:49:13.686567+0100 Project10 - Names & Faces App[90897:7865790] [Camera] Failed to read exposureBiasesByMode dictionary: Error Domain=NSCocoaErrorDomain Code=4864 " -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL" UserInfo={NSDebugDescription= -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL}

2      

I tried this:

    @objc func addNewPerson() {
        let picker = UIImagePickerController()
        picker.allowsEditing = true
        if UIImagePickerController.isSourceTypeAvailable(.camera) {
            picker.sourceType = .camera
        }
        picker.delegate = self
        present(picker, animated: true)
    }

Paul said this'll only be true on device. In the simulator, it'll return false and show the photo library picker.

But on my iPhone this locks up the app.

1      

Hacking with Swift is sponsored by Emerge

SPONSORED Why are Swift reference types bad for app startup time, and what’s the performance cost of protocol conformances? That’s just a couple of the topics you can learn about on the Emerge blog — written by the app performance experts behind Emerge’s advanced app optimization and monitoring tools, based on their experience of working at companies like Apple, Airbnb, Snap, and Spotify.

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.