I'm trying to use the Google Geolocation api, within Xcode using Swift, to allow the conversion of text address to latitude and longitude.

<http://maps.googleapis.com/maps/api/geocode/json?address=washington%20dc> is an example JSON call.

the error: *Type 'String' does not confirm to protocol 'NSCopying'*, appears when trying to access elements within the dictionary of results.

```
@IBAction func submitButtonPressed(sender: AnyObject) {
    var address = addAddressTextField.text
    var escapedAddress = address.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
    let urlpath = "http://maps.googleapis.com/maps/api/geocode/json?address=" + escapedAddress!
    println(urlpath)

    let url = NSURL(string: urlpath)!

    let urlSession = NSURLSession.sharedSession()

    let jsonQuery = urlSession.dataTaskWithURL(url, completionHandler: { (data, responce, error) -> Void in

        if error != nil{
            println("there is an error")
        }

        var err : NSError?

        var results = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as NSDictionary

        if err != nil{
            println("there is a second error")
        }

        let formattedAddress: AnyObject! = results["results"]![0]!["formatted_address"]!
        let latitude: AnyObject! = results["results"]![0]!["geometry"]!["location"]!["lat"]!
        let longitude: AnyObject! = results["results"]![0]!["geometry"]!["location"]!["lng"]!

        dispatch_async(dispatch_get_main_queue(), { () -> Void in
            self.fullAddressLabel.text = "\(formattedAddress)"
            self.latLabel.text = "\(latitude)"
            self.longLabel.text = "\(longitude)"

        })

    })

    jsonQuery.resume()
}

```

The error only occurs on the lines:

```
let latitude: AnyObject! = results["results"]![0]!["geometry"]!["location"]!["lat"]!
let longitude: AnyObject! = results["results"]![0]!["geometry"]!["location"]!["lng"]!

```

and the let formattedAddress: AnyObject! = ... line works perfectly.

I have tried defining the variables as Strings and NSStrings and using '... as String' within the definition but to no luck.