extension PHAsset {
var originalFilename: String? {
var fname:String?
let resources = PHAssetResource.assetResources(for: self)
if let resource = resources.first {
fname = resource.originalFilename
}
return fname
}
}
I am using this extension of PHAsset to get the Original file name of asset. There are approximately 2000 assets, this extension gives the original file name of first 300 assets and after that it returns nil. I'm confused that how is it possible? Is there any bug in Xcode? however I'm using Xcode 8.1 and swift 3.0. Can anyone help me out to solve this issue? Thanks in advance.