Ios 如何获取位置
我用这种方法只需要一个单元格就可以了。我想问一下这个方法可以把我的手机全部定位吗Ios 如何获取位置,ios,location,swift2,ibeacon,estimote,Ios,Location,Swift2,Ibeacon,Estimote,我用这种方法只需要一个单元格就可以了。我想问一下这个方法可以把我的手机全部定位吗 manager.fetchUserLocationsWithSuccess({ (response) in let locations = response as! [ESTLocation] if let kitchen = locations.filter({ $0.identifier == locationname }).first { self.location = ki
manager.fetchUserLocationsWithSuccess({ (response) in
let locations = response as! [ESTLocation]
if let kitchen = locations.filter({ $0.identifier == locationname }).first {
self.location = kitchen
self.indoorLocationView.positionView = self.positionView
self.indoorLocationView.drawLocation(self.location)
self.manager.startIndoorLocation(self.location)
self.title = self.location?.name
} else {
print("location not found")
}
}, failure: { (error: NSError!) in
print("error when fetching locations: \(error)")
})
此方法已返回所有位置的列表:
let locations = response as! [ESTLocation]
然后,在接下来的一行中,将对所有位置的数组进行筛选,以查找标识符
等于位置名称
设置为:
let kitchen = locations.filter({ $0.identifier == locationname }).first
因此,如果您想对所有位置进行操作,只需去掉过滤器,使用
locations
变量即可。对不起,我无法理解location变量,您能解释更多吗?谢谢