0

In Xcode 7.3 (using Swift) I've created the most simple map example:

  • Imported MapKit
  • Created an outlet called mapView

For some reason, there's no autocomplete with my outlet. Even when I type 'ma' it does not come up with the outlet name 'mapView'.

Can anyone help get autocomplete working?

Code from: ViewController.swift

import UIKit
import MapKit

class ViewController: UIViewController {

    @IBOutlet weak var mapView: MKMapView!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


    // mapView doesnt appear when I begin to type it

    // also it doesn't show any functions when I type mapView.


}

I've also uploaded my project to dropbox: https://www.dropbox.com/sh/rgefwafhanti1wa/AABhQt8TsbvesaO9zg-SydlRa?dl=0

1 Answers1

0

You also need to add the MapKit framework in Build Phases for the target.

fsb
  • 290
  • 10
  • 28
  • I believe I've done this already, here is a screenshot of the Build Phases: https://dl.dropboxusercontent.com/u/47501284/simple_map/Screen%20Shot%202016-04-14%20at%2020.02.23.png – null_complaints Apr 14 '16 at 19:05
  • Sorry, I can't access dropbox from my location so I'm not able to see your image. The 3 things you need to do are 1) add the mapkit.framework to the build phase of the target under Link Binary with Library, 2) import mapkit, and 3) declare your outlet (@IBOutlet var mapView:MKMapView?) and connect your MapView. – fsb Apr 14 '16 at 19:20
  • Maybe change your outlet and remove 'weak' and not force-unwrap it there? – fsb Apr 14 '16 at 19:21
  • I've created a new project and followed these steps, the autocomplete still does not work properly. I believe it may be a general issue for Xcode 7.3 as others have reported autocomplete not working correctly, for example: http://stackoverflow.com/questions/36169099/xcode-7-3-autocomplete-is-so-frustrating – null_complaints Apr 15 '16 at 08:36
  • Maybe delete Xcode and reinstall. I don't have any problems with autocomplete but I can see that many people are having issues. Sorry I couldn't help. – fsb Apr 15 '16 at 11:49