[英]no visible @interface for declares the selector errors
我得到'NSObject'沒有可見的@interface在行上聲明選擇器'viewDidLoad':
[super viewDidLoad];
[_viewWeb loadRequest:requestObj];
[super didReceiveMemoryWarning];
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
#import <Foundation/Foundation.h>
@interface UIViewControllerHUB : NSObject
@property (strong, nonatomic) IBOutlet UIView *viewWeb;
@end
我怎樣才能解決這個問題?
以上所有解決方案現已解決。
下面的新錯誤:
現在獲得'UIView'的'不可見@interface'聲明選擇器'loadRequest:'在線
[_viewWeb loadRequest:requestObj];
viewDidLoad
是一個UIViewController
方法。 要修復它,請更改為繼承:
#import <Foundation/Foundation.h>
@interface UIViewControllerHUB : UIViewController
@property (strong, nonatomic) IBOutlet UIView *viewWeb;
@end
在你的代碼中'沒有可見的@interface for UIView
聲明選擇器'loadRequest:'在線為什么你得到這個錯誤是因為loadRequest
不是UIView
的方法。 但盡管如此,它仍然是UIWebView
的方法。 有關更多信息,請參閱此UIWebView文檔 。 所以只需將UIView
替換為UIWebView
並檢查即可
//評論這個
//@property (strong, nonatomic) IBOutlet UIView *viewWeb;
//修改它
@property (strong, nonatomic) IBOutlet UIWebView *viewWeb;
注意: - 你已經創建了UIView
出口。 因此刪除相同的並拖放UIWebView,然后將outlet
重新連接到UIWebView
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.