Skip to content

Commit

Permalink
fix: Fatal error: Attempted to read an unowned reference but the obje…
Browse files Browse the repository at this point in the history
…ct was already deallocated
  • Loading branch information
zhengzeqin007 authored and LuisThein committed Jan 25, 2024
1 parent 2414c34 commit f535510
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ios/Classes/MapView/AppleMapController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,22 @@ extension AppleMapController {
snapShot?.cancel()

if #available(iOS 10.0, *) {
snapShot?.start { [unowned self] snapshot, error in
snapShot?.start { [weak self] snapshot, error in
guard let self = self else {
return
}

guard let snapshot = snapshot, error == nil else {
onCompletion(nil, error)
return
}

let image = UIGraphicsImageRenderer(size: self.snapShotOptions.size).image { context in

let image = UIGraphicsImageRenderer(size: self.snapShotOptions.size).image { [weak self] context in
guard let self = self else {
return
}
snapshot.image.draw(at: .zero)
let rect = snapShotOptions.mapRect
let rect = self.snapShotOptions.mapRect
if options.showAnnotations {
for annotation in self.mapView.getMapViewAnnotations() {
self.drawAnnotations(annotation: annotation, point: snapshot.point(for: annotation!.coordinate))
Expand Down

0 comments on commit f535510

Please sign in to comment.