Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Of course I googled and used the search within stackoverflow. I found some similar discussions:

Could not instantiate class named MKMapView

http://forums.bignerdranch.com/viewtopic.php?f=49&t=490

NSInvalidUnarchiveOperationException: cannot decode object of class (UITableViewCellContentView)

... and lots of copies of that :)

However, I am not using SDK 3.2 but 5.0 (one of the linked discussions suggest it was an error in some beta version of SDK 3.2).

The other discussions and answers suggest that the framework MapKit were not included properly. I tried to include it several ways, following those instructions.

I am still getting this error. It is thown on

    [super loadView];

within my own view controller's

- (void)loadView {

method. The view itself is build within IB. Beside other items is has an MKMapView.

I am using MKMapView in two of my xcode projects. Both were started in xcode 3.2 and now migrated to xcode 4. Within one of the projects the code works fine and in the other one I get this runtime error. I did not identify any significant difference between these projects' setups that could explain this diffrent behaviour to me.

A current workaround is to take off any code (and IB item) that is relatd to a Map View. But in the end I'd rather include that map view because it does serve a purpose :)

Any suggestion is appreciated.

Hermann

like image 667
Hermann Klecker Avatar asked Nov 21 '11 19:11

Hermann Klecker


1 Answers

Go to your target settings - not project level but target level. Click on Build Phases, then expand Link Binary with Libraries. Ensure that MapKit.framework is listed and add it if not.

like image 70
TomSwift Avatar answered Oct 01 '22 22:10

TomSwift