0

Xcode says that PHAsset doesn't have the 'location' member.

What's the remedy for Swift?

enter image description here

Frederick C. Lee
  • 9,019
  • 17
  • 64
  • 105

1 Answers1

1

Short answer: you might have forgotten to import CoreLocation;

import Photos
import CoreLocation

let asset: AnyObject? = nil

if let asset = asset as? PHAsset {
    let location = asset.location
}

When I remove the CoreLocation import, I can replicate your error.

Ron
  • 1,610
  • 15
  • 23
  • Also related (happens in Obj-C too): http://stackoverflow.com/questions/25581871/getting-the-location-of-a-phasset-in-swift – ayman Aug 20 '15 at 00:19