You can get the location of each PHAsset as simple as these lines of code:
let phFetchRes = PHAsset.fetchAssets(with: PHAssetMediaType.image , options: nil) // Fetch all PHAssets of images from Camera roll let asset = phFetchRes.object(at: 0) // retrieve cell 0 as a asset let location = asset.location // retrieve the location print(location) // Print result
Or, if you want to get all locations from PHAsset, you can use the codes above, for example:
let phFetchRes = PHAsset.fetchAssets(with: PHAssetMediaType.image , options: nil) // Fetch all PHAssets of images from Camera roll phFetchRes.enumerateObjectsUsingBlock({asset, index, stop in if let ass = asset as? PHAsset{ println(ass.location) } }
source share