DaveWoodCom / XCGLogger

A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ClegeJJ opened this issue · 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