没有可见的@interface for 声明选择器错误 [英] no visible @interface for declares the selector errors

查看:14
本文介绍了没有可见的@interface for 声明选择器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到 No visible @interface for 'NSObject' 声明选择器 'viewDidLoad' on行:

I'm getting No visible @interface for 'NSObject' declares the selector 'viewDidLoad' on the lines:

[super viewDidLoad];

[_viewWeb loadRequest:requestObj];

[super didReceiveMemoryWarning];

UIViewControllerHUB.m

UIViewControllerHUB.m

#import "UIViewControllerHUB.h"

@interface UIViewControllerHUB ()
@property (strong, nonatomic) NSMutableArray *subItems;
@end

@implementation UIViewControllerHUB

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSString *fullURL = @"http://conecode.com";
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [_viewWeb loadRequest:requestObj];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

UIViewControllerHUB.h

UIViewControllerHUB.h

#import <Foundation/Foundation.h>

@interface UIViewControllerHUB : NSObject
@property (strong, nonatomic) IBOutlet UIView *viewWeb;

@end

我该如何解决这个问题?

How can I fix this?

以上所有问题现在都已解决.

EVERYTHING ABOVE IS NOW RESOLVED.

下面的新错误:

现在得到 'No visible @interface for 'UIView' 声明选择器 'loadRequest:'在线

Now getting 'No visible @interface for 'UIView' declares the selector 'loadRequest:' on line

    [_viewWeb loadRequest:requestObj];

推荐答案

在你的代码中 'No visible @interface for UIView 声明了选择器 'loadRequest:' 在线为什么会出现此错误是因为 loadRequest 不是 UIView 的方法.但尽管如此,它是UIWebView 的方法.有关更多信息,请参阅此 UIWebView 文档.所以只需将 UIView 替换为 UIWebView 并检查

In your code 'No visible @interface for UIView declares the selector 'loadRequest:' on line why you are getting this error is becuase loadRequest is not the method of UIView. But in-spite of that it is the method of UIWebView. For more refer this UIWebView documentation . So just replace UIView to UIWebView and check

//评论这个

//@property (strong, nonatomic) IBOutlet UIView *viewWeb;

//修改这个

@property (strong, nonatomic) IBOutlet UIWebView *viewWeb;

注意:- 因为您已经创建了 UIView 的插座.所以删除相同并拖放 UIWebView 然后将 outlet 重新连接到 UIWebView

Note:- As you have created outlet of UIView. So delete the same and drag-drop UIWebView and then reconnect the outlet to UIWebView

这篇关于没有可见的@interface for 声明选择器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆