我正在学习Swift 3,我目前的学习项目涉及允许用户拍摄照片并获取当前位置固定的地图快照.
我从2015年8月开始依赖这个答案,并从2016年6 月起回答这个问题,但是我仍然找不到合适的路径.
现在,我可以......
但我只是不能放置引脚.我知道我的代码不完整且无效 - 所以这不仅仅是一个调试问题.以下是我一直在使用的内容(以及基于以上链接的许多变体):
let snapShotter = MKMapSnapshotter(options: mapSnapshotOptions)
snapShotter.start() {
snapshot, error in
guard let snapshot = snapshot else {
return
}
let image = snapshot.image
let annotation = MKPointAnnotation()
annotation.coordinate = needleLocation // is a CLLocationCoordinate2D
annotation.title = "My Title"
let annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "annotation")
// I want to push the final image to a global variable
// can't figure out how to define finalImage as …Run Code Online (Sandbox Code Playgroud)