Swift:api调用中预期的表达式错误
这是我对斯威夫特的第一篇新文章。在YelpAPI上构建我的第一个真正的应用程序 我在searchWithCLL方法中遇到预期的表达式错误。我想可能是因为cll(纬度,经度)。或者我的变量?有人能提供建议吗Swift:api调用中预期的表达式错误,swift,Swift,这是我对斯威夫特的第一篇新文章。在YelpAPI上构建我的第一个真正的应用程序 我在searchWithCLL方法中遇到预期的表达式错误。我想可能是因为cll(纬度,经度)。或者我的变量?有人能提供建议吗 func getYelpBusinesses() { // Current Location var currentLocation = locationManager.location var latitude = currentLocation.coordinat
func getYelpBusinesses() {
// Current Location
var currentLocation = locationManager.location
var latitude = currentLocation.coordinate.latitude
var longitude = currentLocation.coordinate.longitude
client.searchWithCLL(term: "Returants", location:"Toronto", cll: (latitude, longitude), success: { (request:AFHTTPRequestOperation!, object:AnyObject!); -> Void in self.yelpHandler.saveYelpObjects(object)}) { (request:AFHTTPRequestOperation!, error:NSError!) -> Void in
//Present an alert view
}
}
感谢您的反馈。正如@Aderstedt在评论中已经提到的那样,您的代码中有一个输入错误,您不需要分号:
(request:AFHTTPRequestOperation!, object:AnyObject!);
^
删除它,它应该会按预期工作。正如@Aderstedt在评论中已经提到的,您的代码中有一个输入错误,您不需要在那里使用分号:
(request:AFHTTPRequestOperation!, object:AnyObject!);
^
删除它,它将按预期工作。在
之后有一个额外的分号(请求:AFHTTPRequestOperation!、对象:AnyObject!)
。在之后有一个额外的分号(请求:AFHTTPRequestOperation!、对象:AnyObject!)
。