'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named MKMapView'
Solution 1
It may sound simple but in the project folder of this app the mapkit files were copied,i removed it from this folder through finder and added the mapkit again.now its working.thanks for the comment by @Craig
Solution 2
Make sure that the MapKit.framework is added to your project.
To verify/add the MapKit framework to your project:
- Click on your project file in the left pane, then click on Build Phases.
- Open up the Link Binary with Libraries
- If you do not see the MapKit.framework, you'll want to add it by clicking on the plus sign.
Solution 3
In Swift using a newer version of Xcode, you only need to turn this capability on in the project settings and the error will go away.
Solution 4
I saw this problem when building a WatchKit extension for iOS. In addition to the linked binary I also had to add a file to Compiled Sources.
Related videos on Youtube
Comments
-
sujith1406 over 1 year
I am doing a project using storyboard(first time using story board).In one of the viewcontroller there is a view with a mapview and a tableview containing prototype cells.I have included the mapkit framework and mapkit headers are imported in the corresponding viewcontroller.But i am getting this wierd error.I checked with many posts and all are pointing to the case where framework is not included.But i have included everything and still getting this issue.i cleaned and built but still this issue.any suggestions
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named MKMapView' #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface CategoryDetailViewController : UIViewController<UITableViewDataSource,UITableViewDelegate,MKMapViewDelegate> @property (weak, nonatomic) IBOutlet MKMapView *mapview; @property (weak, nonatomic) IBOutlet UITableView *tableView; @end
-
Gabriele PetronellaDouble check the framework linking, it's likely it.
-
CraigTake it out and add it again. The process of doing that might re-register it with what ever it needs to be registered with.
-
sujith1406its correct only ..in the list of added frameworks ...mapkit is there
-