I keep getting this error but I have no idea where it's coming from.
linker command failed with exit code 1 (use -v to see invocation)
How do I fix this?
Here's the code from WebView.m
#import "WebViewController1.h"
@interface ViewController ()
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@property (weak, nonatomic) IBOutlet UIWebView *webView2;
@end
@implementation ViewController
Here's the code from WebViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
You have done one of two things wrong here.
You either mistakenly imported ViewController.m
(instead of ViewController.h
) into WebView.m
. Or your WebView.h
and .m
mistakenly declare the ViewController
class instead of the WebView
class.
Based on the comments and the updated question it seems to be latter problem.
Both ViewController.h/.m
and WebView.m/WebViewController.h
declare the class ViewController
.
WebView.m
to WebViewController.m
. It makes things a lot clearer if the .h and .m for a class are the same and have the same name as the class.Fix WebViewController.h
so you declare WebViewController
instead of ViewController
:
@imterface WebViewController : UIViewController
Fix WebViewController.m
(the former WebView.m
so you define WebViewController
instead of ViewController
.
#import "WebViewController.h"
@interface WebViewController ()
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@property (weak, nonatomic) IBOutlet UIWebView *webView2;
@end
@implementation WebViewController