DaveWoodCom/XCGLogger

Initializer for conditional binding must have Optional type, not 'Data'

ClegeJJ opened this issue · 2 comments

XCGLogger (6.1.0)
Swift version: 5.0

image

Same issue, @ClegeJJ Are you fixed it?

guard let archivedLogIdentifierOptionalData = try? fileURL.extendedAttribute(forName: XCGLogger.Constants.extendedAttributeArchivedLogIdentifierKey) else { continue }
guard let archivedLogIdentifierData = try? archivedLogIdentifierOptionalData else { continue }
guard archivedLogIdentifierData == identifierData else { continue }

        guard let timestampOptionalData = try? fileURL.extendedAttribute(forName: XCGLogger.Constants.extendedAttributeArchivedLogTimestampKey) else { continue }
        guard let timestampData = try? timestampOptionalData else { continue }
        guard let timestamp = String(data: timestampData, encoding: .utf8) else { continue }

        archivedDetails.append((fileURL, timestamp))

@3s-tiennm Please make sure you're using the right version of XCGLogger for the version of Swift you're working with. The above issue was due to using XCGLogger 6.1.0 with Swift 5.0, instead of XCGLogger 7.0.

See https://github.com/DaveWoodCom/XCGLogger#backwards-compatibility