Ypimagepicker: Xcode 12: Cannot convert value of type 'CMTime' to type 'NSValue' in coercion

Created on 16 Sep 2020  路  6Comments  路  Source: Yummypets/YPImagePicker

I am using v 4.3.1

Upon updating Xcode to 12, I cannot build my app!

This error occurs in ThumbSelectorView.swift Line 141
Cannot convert value of type 'CMTime' to type 'NSValue' in coercion

Screen Shot 2020-09-16 at 5 33 41 PM

Xcode12 / iOS14

Most helpful comment

@grantespo
Modify [time as NSValue] to [NSValue(time: time)]
generator?.generateCGImagesAsynchronously(forTimes: [NSValue(time: time)],

@timothyerwin
Occurs only in the simulator.

if arch(i386) || arch(x86_64)

settings.flashMode = .off

else

if let deviceInput = deviceInput {
        if deviceInput.device.isFlashAvailable {
        switch currentFlashMode {
        case .auto:
            if photoOutput.supportedFlashModes.contains(.auto) {
                settings.flashMode = .auto
            }
        case .off:
            if photoOutput.supportedFlashModes.contains(.off) {
                settings.flashMode = .off
            }
        case .on:
            if photoOutput.supportedFlashModes.contains(.on) {
                settings.flashMode = .on
            }
        }
    }
}

endif

its work for me.

All 6 comments

I'm getting the same problem...when I fixed this I got a lot of other build errors for YPImagePicker:

e.g.

/Pods/YPImagePicker/Source/Pages/Photo/PostiOS10PhotoCapture.swift:53:36: Value of type 'AVCapturePhotoOutput' has no member 'supportedFlashModes'

/Pods/YPImagePicker/Source/Pages/Photo/PostiOS10PhotoCapture.swift:53:66: Cannot infer contextual base in reference to member 'auto'

@grantespo
Modify [time as NSValue] to [NSValue(time: time)]
generator?.generateCGImagesAsynchronously(forTimes: [NSValue(time: time)],

@timothyerwin
Occurs only in the simulator.

if arch(i386) || arch(x86_64)

settings.flashMode = .off

else

if let deviceInput = deviceInput {
        if deviceInput.device.isFlashAvailable {
        switch currentFlashMode {
        case .auto:
            if photoOutput.supportedFlashModes.contains(.auto) {
                settings.flashMode = .auto
            }
        case .off:
            if photoOutput.supportedFlashModes.contains(.off) {
                settings.flashMode = .off
            }
        case .on:
            if photoOutput.supportedFlashModes.contains(.on) {
                settings.flashMode = .on
            }
        }
    }
}

endif

its work for me.

@colbylim thanks that worked,
but to fixup timothy's issue, I just removed the flash code altogether since i am only using the image picker.

if use cocoapods, you can add this line to your podfile:

pod 'PryntTrimmerView', :git => 'https://github.com/HHK1/PryntTrimmerView.git'

nope, change pod code is not good solution

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StackHelp picture StackHelp  路  4Comments

pngo-hypewell picture pngo-hypewell  路  7Comments

Berk-Kaya picture Berk-Kaya  路  3Comments

AndreiBoariu picture AndreiBoariu  路  5Comments

rajabpour picture rajabpour  路  3Comments