[Log Data]

Data Value[1] : 파일명 : DJI_20221127_145535_909.jpg

Data Value[2] : 3.61 MB

var fileSize = ""
let resources = PHAssetResource.assetResources(for: assets[i])
let filename = resources.first!.originalFilename

//MB로 변환
var sizeOnDisk: Int64 = 0
if let resource = resources.first {
    let unsignedInt64 = resource.value(forKey: "fileSize") as? CLong
    sizeOnDisk = Int64(bitPattern: UInt64(unsignedInt64!))
    fileSize = String(format: "%.2f", Double(sizeOnDisk) / (1024.0*1024.0))+" MB"
    
    log(direction: .ETC, ofType: self, datas: "파일명 : \(filename)", fileSize)
}

 

+ Recent posts