0

I am receiving the following error: Use of undeclared type 'MKMapView'.

I know this question was already asked but the answers are not the ones I'm looking for. I have already imported MapKit and UIKit.

import UIKit
import MapKit
import CoreLocation

class SecondViewController: UIViewController, CLLocationManagerDelegate {
  @IBOutlet var mapView: MKMapView! // Error occurs.

I should note that the code runs just fine with no errors when I test it in the simulator but when I try to build it on my iPhone 6 (11.1) it gives me this error. I am using xCode 9.1 beta 1.

Dennis Vennink
  • 1,083
  • 1
  • 7
  • 23

1 Answers1

0

This might be a collision with the actual MapKit framework because the modules have the same name. Check that your application's name is not MapKit. If this didn't work try cleaning your project and building it again or restarting Xcode.

M. Tarek
  • 21
  • 5
  • @m-tarek When you say check that my applications name is not MapKit do you mean like what I am calling the app itself as it would appear in the App Store? Because if so then it is not called MapKit. Also I already cleaned it many times with no luck as well as deleted the derived data and tried to rebuild it with the same results... –  Oct 08 '17 at 00:28
  • @MattMech I don't mean the display name of the app, I mean the project's name itself. It usually appears in the project navigator as your root project. – M. Tarek Oct 08 '17 at 12:19
  • @m-tarek So do you mean the ViewController name? If so none of my Controllers have any names related to MapKit. –  Oct 08 '17 at 19:00
  • @MattMech Not the view controller's name, the **project's name**. You can check how to change your project's name [here](https://stackoverflow.com/a/35500038/6616757) – M. Tarek Oct 10 '17 at 00:37