【问题标题】:web view illegal interface qualifier网页视图非法接口限定符
【发布时间】:2014-08-08 08:01:17
【问题描述】:

在 Xcode 中工作,我试图在我的应用程序中添加第二个 Web 视图,但不断收到非法的界面限定符消息。

这是我的实现文件:

#import "XYZBonBonoftheDayViewController.h"

@interface XYZBonBonoftheDayViewController ()
@synthesize webView;
@end

@implementation XYZBonBonoftheDayViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    }
    return self;
}

- (void)viewDidLoad
{
    NSURL *url = [NSURL URLWithString:@"http://www.who.int/mediacentre/factsheets/fs103/en/"];
    NSURLRequest *requestURL = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestURL];
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

@end

...和我的接口文件:

#import <UIKit/UIKit.h>

@interface XYZBonBonoftheDayViewController : UIViewController

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

@end

如果有人可以的话,我真的很感激这里的帮助!

提前干杯!


标题

【问题讨论】:

    标签: ios objective-c uiwebview


    【解决方案1】:

    我认为你只需要删除

    @synthesize webView;
    

    请更换

    @interface XYZBonBonoftheDayViewController ()
    @synthesize webView;
    @end
    

    @interface XYZBonBonoftheDayViewController ()
    
    @end
    

    在你的实现文件中。

    问候。

    【讨论】:

    • 非常感谢,我试过了,但是当我在模拟器中运行应用程序时,我的 WebView 中什么也没有出现。你知道为什么会这样吗?
    • 你在 Xib 中添加了 Webview 吗?您是否在 XIB 中为 webview 链接了数据集和委托?请更改 [webView loadRequest:requestURL];到 [self.webView loadRequest:requestURL];
    • 不,我用过的教程都没有提到这一点。我会试一试,谢谢:)
    • 使用故事板或以编程方式浏览本教程。hayageek.com/uiwebview-uiwebviewdelegate-tutorial
    • 非常感谢,会做的!
    猜你喜欢
    • 2012-02-01
    • 2015-11-24
    • 2016-07-21
    • 1970-01-01
    • 2017-10-10
    • 1970-01-01
    • 1970-01-01
    • 2016-12-19
    • 2023-03-24
    相关资源
    最近更新 更多