yeahdongcn / RSBarcodes_Swift

1D and 2D barcodes reader and generators for iOS 8 with delightful controls. Now Swift.
MIT License
707 stars 185 forks source link

XCode 12 Beta 6, compiler error #139

Closed AndrexOfficial closed 4 years ago

AndrexOfficial commented 4 years ago

I was tying to build my project where I use RSBarcodes but I get a compiler error saying that: Value of type 'AVMetadataMachineReadableCodeObject' has no member 'corners'

It occurs on RSCodeReaderViewController.swift at line 401.

How can I fix it?

yeahdongcn commented 4 years ago

There used to be an extension:

extension AVMetadataMachineReadableCodeObject {

    @available(swift 4.0)
    @available(iOS 7.0, *)
    @nonobjc public var corners: [CGPoint] { get }
}

I don't' know why they are gone in Xcode 12 Beta 6. How about filing a FB to Apple?

yeahdongcn commented 4 years ago

I didn't find anything related on the release notes page (https://developer.apple.com/documentation/xcode-release-notes/xcode-12-beta-release-notes/), so maybe comment this line out for now (you won't see the corners drawn on the reader view).

sammcewan commented 4 years ago

Still a problem in GM 😬

adougies commented 4 years ago

Looks like someone has already filed, plus seems more properties have issues too: https://developer.apple.com/forums/thread/658471

Apple documentations suggests this hasn't been removed: https://developer.apple.com/documentation/avfoundation/avmetadatamachinereadablecodeobject/2926566-corners

Someone interestingly said:

This happened before and is related to how obj-c symbols are imported in Swift, not deprecation/removal of API. corners at least exists in the non-simulator SDK, so you can perhaps work-around using #if !targetEnvironment(simulator).

This means, as the bug appears to only affect the simulator, the following code can be used to fix the error until the issue is resolved.

#if !targetEnvironment(simulator)
     cornersArray.append(barcodeObject.corners)
#endif
yeahdongcn commented 4 years ago

🎉 Congrats

🚀 RSBarcodes_Swift (5.1.0) successfully published 📅 September 17th, 20:01 🌎 https://cocoapods.org/pods/RSBarcodes_Swift 👍 Tell your friends!