File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -322,15 +322,22 @@ extension AppleMapController {
322322 snapShot? . cancel ( )
323323
324324 if #available( iOS 10 . 0 , * ) {
325- snapShot? . start { [ unowned self] snapshot, error in
325+ snapShot? . start { [ weak self] snapshot, error in
326+ guard let self = self else {
327+ return
328+ }
329+
326330 guard let snapshot = snapshot, error == nil else {
327331 onCompletion ( nil , error)
328332 return
329333 }
330-
331- let image = UIGraphicsImageRenderer ( size: self . snapShotOptions. size) . image { context in
334+
335+ let image = UIGraphicsImageRenderer ( size: self . snapShotOptions. size) . image { [ weak self] context in
336+ guard let self = self else {
337+ return
338+ }
332339 snapshot. image. draw ( at: . zero)
333- let rect = snapShotOptions. mapRect
340+ let rect = self . snapShotOptions. mapRect
334341 if options. showAnnotations {
335342 for annotation in self . mapView. getMapViewAnnotations ( ) {
336343 self . drawAnnotations ( annotation: annotation, point: snapshot. point ( for: annotation!. coordinate) )
You can’t perform that action at this time.
0 commit comments