Could not instantiate class named MKMapView

2019-01-31 04:31发布

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, added the MapKit.framework to the project, added the property / etc. to the header. Go to run the project and get a SIGABRT with

****Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named MKMapView'**

I found http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial/ but, like I said, I've already added framework. What am I missing?

9条回答
SAY GOODBYE
2楼-- · 2019-01-31 05:27

Please import the WebKit at your Build Phases. You need to import the WebKit

查看更多
ゆ 、 Hurt°
3楼-- · 2019-01-31 05:31

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.

查看更多
聊天终结者
4楼-- · 2019-01-31 05:38

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

查看更多
登录 后发表回答