gpt4 book ai didi

objective-c - 没有可见的@interface 用于声明选择器错误

转载 作者:太空狗 更新时间:2023-10-30 03:54:02 25 4
gpt4 key购买 nike

我没有看到“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

我该如何解决这个问题?


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

下面的新错误:

现在得到“No visible @interface for 'UIView' declares the selector 'loadRequest:'在线

    [_viewWeb loadRequest:requestObj];

最佳答案

在你的代码中'No visible @interface for UIView declares the selector 'loadRequest:' online 为什么你得到这个错误是因为loadRequest 不是 UIView 的方法。但尽管如此,它还是 UIWebView 的方法。有关更多信息,请参阅此 UIWebView documentation .所以只需将 UIView 替换为 UIWebView 并检查

//评论这个

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

//修改这个

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

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

关于objective-c - 没有可见的@interface 用于声明选择器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20725801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com