Could not instantiate class named MKMapView

后端 未结 9 1356
天涯浪人
天涯浪人 2020-12-23 20:14

I may be doing something really stupid here as I\'ve done it before and it worked and now...

Created a new iPad project, in the details view I added a MKMapView, add

相关标签:
9条回答
  • 2020-12-23 20:26

    Easy way!

    Works above Xcode version 7.2

    As far as I'm concerned selecting the MAPS from capabilities will automatically link your framework to your project all you have to do is check the Maps button in Capabilities -> Maps.

    Heres the attached screenshot. Cheers!!

    0 讨论(0)
  • 2020-12-23 20:30

    I noticed that I was getting this message (on top of the original one mentioned in this post) when I was building and running on the simulator:

    ld: warning: ignoring file /Users/peter/programming/iPhone/iNspector/MapKit.framework/MapKit, file was built for unsupported file format which is not the architecture being linked (i386)

    Then I just connected my iPhone, build and ran on the device, and the map worked.

    So it seems that the MapKit framework cannot be compiled on the 386 architecture, it needs the device.

    0 讨论(0)
  • 2020-12-23 20:35

    Please import the WebKit at your Build Phases.

    0 讨论(0)
  • 2020-12-23 20:37

    I also received this error when trying to deploy to my 5.1 phone (with XC 4.5), even after changing my deployment target to be 5.1. Looks like the maps update wouldn't fly since I still had Google Maps on my phone. After updating my phone's OS, the exception disappeared.

    0 讨论(0)
  • 2020-12-23 20:41

    In regards to @futureshocked's input, I also came across the

    Id: warning: ignoring file /blah.../MapKit, file was built for unsupported file format which is not the architecture being linked (i386)

    issue.

    **Check to make sure you didn't copy the MapKit framework into your local project directory when you added it to your project. I accidentally did this and XCode was giving me the above error. So I removed it from my project directory (in Finder), recompiled, and everything was normal again.

    If you don't have the Framework in your project, go ahead and re-link as stated in the answer above.

    Found a good tutorial on getting started with MapKit:
    http://www.youtube.com/watch?v=X-3jM24EIGM&feature=related

    0 讨论(0)
  • 2020-12-23 20:44

    Click on your project to bring the project settings. Under Targets, click your project, select from the upper toolbar "Build Phases". Under "Link binary With Libraries" tab, you will see the list of frameworks included in your project. Click the "+" button and add MapKit library from the shown list to your project.

    0 讨论(0)
提交回复
热议问题