Error create Point in map

Sorry i dont't spea english very well

Please help, i have one error in my code , i don't have apresentation one point in map (the cordenate the point is save one file ) my code :

class mapViewController : UIViewController {
   
    @IBOutlet weak var mapView: MKMapView!
    /
    func getFilepath() -> String
    {
        let userDomainPaths: NSArray = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
       
        let filepath: String = userDomainPaths.objectAtIndex(0) as! String
       
        return "\(filepath)/afMyLocation.plist"
    }
    /
    /
   
   
   
    /
   
    override func viewDidLoad() {
        super.viewDidLoad()
        print("LOG : Map carregado com sucesso")
        /
       
       
        let FLatitude : Double?
        let FLongitude : Double?
       
        let filepathAux: String = self.getFilepath()
        if(NSFileManager.defaultManager().fileExistsAtPath(filepathAux) == true) {
            print("Verificou se existe arquivo - crioui cordenadas")
            let array: NSArray = NSArray(contentsOfFile: filepathAux)!
            let FLatitude : String?
            let FLongitude : String?
            FLatitude = (array.objectAtIndex(0) as? String)!
            FLongitude = (array.objectAtIndex(1) as? String)!
                    } else {
            print("Erro ao recuperar posicao")
            /
        }
       
        /
        /
            /
       
        /
            let location = CLLocationCoordinate2D(
                latitude: 51.50007773,
                longitude: -0.1246402
            )
            /
            let span = MKCoordinateSpanMake(0.05, 0.05)
            let region = MKCoordinateRegion(center: location, span: span)
            mapView.setRegion(region, animated: true)
           
            /
            let annotation = MKPointAnnotation()
            annotation.coordinate = location
            annotation.title = "Big Ben"
            annotation.subtitle = "London"
            mapView.addAnnotation(annotation)
        }
        }
       
        /
        /
       
        /
                /
      

How can fix ?

Sorry my comunication

Thank

Answered by afurlan in 63953022

Have you also implemented viewForAnnotation in your map view delegate? You must create and return an MKAnnotationView when asked for it by the map view.

Accepted Answer
Error create Point in map
 
 
Q