2013-12-22 49 views
5

我越來越不可見@interface爲 'NSObject的' 聲明選擇 'viewDidLoad中' 上 行:因爲沒有明顯的@interface聲明選擇錯誤

[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]; 
+0

如果您有新問題,請提出新問題;不要編輯舊的。在這種情況下,您可能需要先查看代碼並在其他問題中查找類似的錯誤。 –

+0

你的代碼是正確的。唯一的問題是你的LoadRequest方法不是UIView方法,而是UIWebView方法。我已經更新了答案,請遵循。 –

回答

1

在你的代碼「爲UIView無可見@interface聲明選擇‘的loadRequest:’在線爲什麼您收到此錯誤是監守loadRequest是不方法UIView。儘管如此,這是UIWebView的方法。更多請參考UIWebView documentation。因此,只需更換UIViewUIWebView和檢查

//評論此

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

//修改此

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

注: - 正如你所創建的UIView出口。因此,刪除相同的拖放UIWebView,然後重新連接outletUIWebView

1

viewDidLoadUIViewController方法。要修復它,改變從繼承:

#import <Foundation/Foundation.h> 

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

@end 
+2

也可以考慮重命名你的類,按照慣例,'UI'前綴只適用於UIKit類。 – MattR

+0

現在得到一個新的錯誤..它在編輯中。 – Nihir

相關問題