'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named MKMapView' - ios

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

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.

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.

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

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

Bazel Xcode Interface Builder: How to do Outlet connect

I am a newbie of Bazel user. I used do the Outlet connection via Xcode Interface Builder (Open as project). But recently I have to use Bazel to build an iOS app. So I just follow the Bazel iOS tutorial: https://bazel.build/tutorials/ios-app. I open the source files UrlGetViewController.h and UrlGetViewController.xib (open as file, not project). Added an extra outlet in the UrlGetViewController.h file as:
#property (weak, nonatomic) IBOutlet UITextField *testTF;
I just can't see that testTF outlet appear on the UrlGetViewController.xib.
Please advice me how to do the outlet connection in this case. Thankyou

Big Nerd Ranch UIKit import

Why is that when I follow Big Nerd Ranch 4th edition I always need to import #import <UIKit/UIKit.h> for any class that contains UIView, UIViewController, CG stuff but the code in the solutions is somehow working without it? Is there any Xcode compliance set up that can be made to make it work well with just #import <Foundation/Foundation.h> import?
For example, in 12th chapter, where they create TouchTracker app, their code is working just fine with:
#import <Foundation/Foundation.h>
#interface BNRLine : UIView
#property (nonatomic) CGPoint begin;
#property (nonatomic) CGPoint end;
#end
However, when I copy this code to my project it does not work without additional #import <UIKit/UIKit.h> line.
They probably use .pch imports. Basically it means that before every source file it will be imported and executed. This tutorial seems like a one you could see whats going on.
They may have additional imports inside a precompiled header file with a .pch extension. You can search for this file in their project.
In Xcode, if you command-click on the import statement you can bring up the detailed list of imports and that should answer any question you may have about what is being imported.

AR Location based Iphone app error

I am in the process of creating an AR based location iphone app using https://github.com/markrickert/iPhone-AR-Toolkit
I have got these errors and do not know how to fix it. Please will someone help me. With a walkthrough and correct code
Link for image http://i60.tinypic.com/2i9p8c0.png
Seems to be trivial but just check whether you have imported the .h File??
#import "ARKit.h"
"Use of undeclared identifier _arViewController". To fix that simply add a property ARViewController *arViewController; to your #interface.
#interface ScanmarksViewController() {
ARViewController *_arViewController;
}
#end
or
#interface ScanmarksViewController()
#property (strong, nonatomic) ARViewController *arViewController;
#end
Whichever you prefer.

Is NSArrayController deprecated, what is its replacement?

I found an Xcode project that uses something called an NSArrayController like this
#import <Cocoa/Cocoa.h>
#interface MyDocument : NSPersistentDocument {
IBOutlet NSArrayController *itemsArrayController;
NSArray *_sortDescriptors;
IBOutlet NSTableView *itemsTableView;
}
I was trying to use the project, which implements drag and drop, as a guide for an app I'm currently building. There's nothing in Xcode documentation when I option click on NSArrayController and I tried to create an NSArrayController property but received a warning that it doesn't exist. Was it deprecated? What has its functionality been replaced by?
NSArrayController is part of the AppKit.framework which is only available on the MacOS platform.

Calling an external class in iOS

I have this class for button which was added to my project workspace. I had
linker error ( Apple Mach-o Linker Error)
Then again i opened a new project and added this class.
In my ViewController.h
#import <UIKit/UIKit.h>
#import <UIView+Glow.h>
#interface ViewController:UIViewController
#property(non atomic,strong) IBOutlet UIView *testView;
end
And in my ViewController.m
Added is the screenshot
#importViewController.h
-(void) viewDidLoad{
[super viewDidLoad];
[testView startGlowing]
}
I had
*unrecognized selector sent to instance error
This is the class
I suggest you use the Glow Category of UIView made by secret lab.
Any suggestion on how to call this class?
attached are the screenshots of the issue
If you have copied UIView+Glow.h into your project, you should use this to import it:
#import "UIView+Glow.h"
You should not use the angle brackets (<UIView+Glow.h>) to import headers that are part of your project.
If you have not copied UIView+Glow.m into your project, you need to do so.
If you have copied UIView+Glow.m into your project, you need to make sure it is included in the “Compile Sources” build phase of your target.
The easiest way to check is to open UIView+Glow.m in the primary editor. Then choose the View > Utilities > Show File Inspector menu item. Look at the File Inspector (on the right side of the Xcode window). Make sure it's showing information for UIView+Game.m. Then look at the “Target Membership” section. Make sure the checkbox next to your target is checked.
Update
The three linker errors in your final screenshot happened because you haven't added the QuartzCore framework to your project. This is the framework that contains the Core Animation classes.
If you don't know how to add a framework to your project, look at How to "add existing frameworks" in Xcode 4?.
Make sure that you use the following line at the top of the implementation file where you want to use the glow methods:
#import "UIView+Glow.h"

Resources